Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

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

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

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

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

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

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / anandthks

head -7 <filename>| tail -1

Is This Answer Correct ?    0 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / hari

hai this Hari

try this

$sed -n '1,7p' <filename>

Is This Answer Correct ?    0 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / hari

$tail 7+ filename|head -1

Is This Answer Correct ?    0 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / srinivas bolusupati

sed '7d' fileName.txt

Is This Answer Correct ?    0 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / krishna reddy

sed -n '7p' <filename>

or
head -8 <filename>|tail -1

Is This Answer Correct ?    0 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / manikandant

sed -n '5p' filename

Is This Answer Correct ?    2 Yes 3 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / sharda mishra

sen -n '7,7p' file name

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Unix Commands Interview Questions

How do you remove a crontab file?

6 Answers  


can we use cat command as an editor ..???

12 Answers   TCS,


What do you mean by zambie process?

6 Answers  


What does the command ' $who | sort –logfile > newfile' do?

0 Answers  


What is ctrl d?

0 Answers  


What command a user use to view a long text file one page at a time in UNIX?

8 Answers   IBM,


How to rename files and folders?

7 Answers   IBM, Oracle,


What UNIX command will control the default file permissions when files are created?

4 Answers  


How does the user view the contents of a text file in UNIX?

9 Answers   IBM,


What is awk used for?

0 Answers  


Explain command to show the space allocation of files?

0 Answers  


What is merge command in unix?

0 Answers  


Categories