Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
grep to find a specific line number
Name: u9717410 Date: September 22, 2004 at 02:32:56 Pacific OS: hp ux 11 CPU/Ram: unknown
Comment:
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 am trying to edit. I have used grep -n and a cut to get the line number of the previous line and i now want to be able to return the line after this one. I know part of the string but this returns several lines i have tried: grep -n $string $file | grep $line_number: $file where $line_number is the previous line number + 1 and $string is the only consistent part of the line but this returns nothing.
Can someone suggest a solution using grep and if not maybe using awk.
Summary: I forgot the command, but i need to view the specific line of the file.. lets say: I have a list of names in the file called "names" for example Modanna George Bush Jacques Chirac and i wanna display...
Summary: I'm trying to remove a specific line from a file based on a user defined input. I had found a similar situation where sed was used, but when I tried using it in my script, sed had trouble with the...