if we create a file, in that 10 rows(means 1,2,....9,10
like). i want 7 row exactly, which command use in unix?
plz send this question.
Answers were Sorted based on User's Feedback
Answer / manu
if you want 1 to 7 row then
head -7 filename
if you want only 7th row exactly then
head -7 filename|tail -1
or
tail +7 filename|head -1
or
cat -n filename|grep '^7' filename
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sivaprasad
hi, this is sivaprasad from school of IT.
If you want exactly 7 line u can use sed command as follows
$sed -n '7,7p' filename
ok.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / niranjan
To display first 7 lines of file:-
1) head -7 filename
2) cat filename|head -7
To display only 7th line of file:-
1) head -7 filename|tail -1
2) cat filename|head -7|tail -1
3) tail +7 filename|head -1
choice is ur's..Which one u feel looks gud...:):):)
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / krishna reddy
sed -n '7p' <filename>
or
head -8 <filename>|tail -1
Is This Answer Correct ? | 0 Yes | 0 No |
What is the use of cut command in unix?
Will rm -r* removes hidden files?
How can we "forked" process in UNIX? How then recognize in any of the branches we?
How would you change all occurrences of a value using VI?
What is an Unix command to convert HEX value to ASCII value located in any flat file.
what is the default permission for /etc/shadow file in UNIX
How do I open a port?
What are the commands in UNIX to list the files in a Directory?
What is the difference between cat command and more command?
What is rmdir command?
How can i know my Filesystem and its current usage in my prod UNIX system?
How to get the operating system's information in unix?