Summary: How I can search file and if word match, script will print that line and, for example, five previous line. (awk or other) 1 2 3 4 5 6 7 8 9 Match then...
Summary: Hello, Currently am positioning at the 100th line with the AWK. How can I read & print its previous line#99th. Your reply is greatly appreciated. Than...
Summary: Hi Guru's, I would like to grep a particular string in a file and the output should print the line containing the grep'd string and next line also. Ca...
Summary: Hi all, I have a text file and I want to clean up the file by only print those lines start with the date. Is there anyway I can do that? Code: [?...
Summary: hello friends! Can anyone advise me how I could script a command that: reads a file, prints 5 lines, then skips 5 lines and then repeats this process...
Summary: hi, i need to print n lines of the file one ater another. my script is something like this i=1 while [i=n] do x=`sed -n $ip path.txt` echo $x #i will ...
Summary: Hi All, How can I find a word and print that line and the next line as well? I know this: awk '{if ($2=="words") {print ab,"\n",$0} {ab=$0}}' file.txt...
Summary: I have this file w/ lot of inputs. now at the end of each input there has to be a "comma". if comma is not there program will ingore that input. so i ...
Summary: Hi, I am new to shell programming and I need your help. I just learn that I can use the sed comand to print certain lines of an input file. e.g. sed ...
Summary: Thanks Nails. Here's the approach I took; see if you can add more sanity to my hacking: -- Since the first target line always ends with "frame:" (a...
Summary: Jern, I used awk because it is much more appropriate for a task such as this. At startup, the BEGIN statement sets the Output Field Separator to the t...
Summary: Albert, you need to omit the -n option, which suppresses the default printing of lines. This will allow all lines (modified or not) to be printed. Th...
Summary: Jerry's solution prints each line containing 2 words. To determine how many unique dates your file contains (keying on word1 in each line), you can is...
Summary: I am attempting to find a particualr line in a file and then replace it. Unfortunatly i can only guaruntee the content of the line prior to the one i...
Summary: Sorry - I think maybe I missed a step in the explanation of what the command is doing. In it's original form the command will read in the lines from t...
Summary: Hello, What is the awk command that will print the 5th line above an expression I tell it to find? Example file: AAB 1 AAB 2 AAB 3 AAB 4 AAB 5 REPORT ...
Summary: For grep, the -v option will negate (or reverse) the result set. grep red grep -v red grep -e red -e blue -e pink grep -ve red -e blue -e pink sed can...
Summary: sed does have hold buffers that can be utilized, but it might be quite difficult to do with sed without BEGIN/END cycles like awk. The following awk s...
Summary: In both of the scripts below, to prevent from losing my indentation, I use leading underscores instead of leading spaces, so you would need to change ...
Summary: (more info from previous message) REVISED SCRIPT: print "starting script ....." while read LINE; do print "Reading line $LINE" CHOICES=$(echo "$LINE" ...
Summary: If you include a variable, the sed command needs to be surrounded with double, not single quotes HOME=/usr/home/bob sed -e "s/${HOME}/replacement_stri...
Summary: I want to print last line of list of files using awk command. tail -1 file will give last line of only 1 file. I want last of line of many files. Thn...