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.
extract a specific line from file
Name: Aristo Date: July 29, 2003 at 22:03:41 Pacific OS: Unix CPU/Ram: ?
Comment:
hi,
can anyone teach me how to extract a specific line from an input file?
Name: Don Arnett Date: July 29, 2003 at 22:25:11 Pacific
Reply:
It depends upon how you want to recognize the specific line. Do you want the fourth line from a file?? Do you want a line that contains a specific phrase?
0
Response Number 2
Name: Aristo Date: July 29, 2003 at 22:29:47 Pacific
How about combination of head and tile in a pipe? Say, you need 4th line:
head -n 4 your_file | tail -n 1
0
Response Number 4
Name: Aristo Date: July 30, 2003 at 00:29:48 Pacific
Reply:
it works..
thank you very much.
0
Response Number 5
Name: David Perry Date: July 30, 2003 at 08:04:00 Pacific
Reply:
lineno=10
sed -n ${lineno}p infile > outfile
0
Response Number 6
Name: HRCafe Date: August 5, 2003 at 05:45:21 Pacific
Reply:
How about extracting the last line of a file. For example, I'm ftp'ing a file from UNIX to an NT box and an extra line is being added to the end of the file on the NT box. All it is is a blank line. I'm guessing this is a tranmission issue but does anyone know how to correct it? Please let me know your thoughts... Thanks!!!
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...
Summary: i hv written a shell script which exports data to a file and i want to filter out one particular line from that file and manipulate that line further. ...
Summary: I have a file with 10000 lines. I want to read the 8800th line into a variable without going through the complete file as it takes a long time. Also I don't know what text is in 8800th line. ...