Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

purpose of -n

3 posters

Go down

purpose of -n Empty purpose of -n

Post by jeeva Thu Mar 04, 2010 5:58 pm

wats the purpose of -n in sed

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

purpose of -n Empty Re: purpose of -n

Post by Christopher Thu Mar 04, 2010 6:21 pm

The -n option tells sed to print only those lines matching the pattern.

eg
Code:
sed -n '/1001/p' sample.txt
It will display all the lines which contains the pattern "1001".
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

purpose of -n Empty Re: purpose of -n

Post by jeeva Thu Mar 04, 2010 6:30 pm

hey i found that

-n means "no automatic output"
no output is displayed unless specified to be printed using /p

jeeva

Posts : 50
Points : 93
Join date : 2010-03-04

Back to top Go down

purpose of -n Empty Re: purpose of -n

Post by akalya Thu Mar 04, 2010 6:32 pm

-when -n is used the output is not displayed...
i.e,
the modifications are not displayed...
to view the modifications ,when -n is used ,we have use p at the end of the reg exp

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

purpose of -n Empty Re: purpose of -n

Post by Christopher Thu Mar 04, 2010 6:40 pm

yup Smile 'p' stands for print
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

purpose of -n Empty Re: purpose of -n

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum