Computing.Net > Forums > Solaris > How to delete particular lines

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.

How to delete particular lines

Reply to Message Icon

Name: smilee4smile
Date: November 13, 2007 at 23:01:12 Pacific
OS: Solaris
CPU/Ram: 256MB
Product: sun
Comment:

Hi,
How can i delete the lines which ever is having **'s in a shadow file.


Thanks & Regards,
Sunil :-



Sponsored Link
Ads by Google

Response Number 1
Name: Sujan (by Sujan Banerjee)
Date: September 5, 2008 at 06:06:28 Pacific
Reply:

Hi Sunil
Sorry for late response.
I am not sure what you wish to delete.
Anyway I want to overwrite file by removing all lines with '**'.
Try
bash#sed '/\*\*/d' sunilfile|sed 'w sunilfile'
If string is say "mystring",it would be:-
bash#sed '/mystring/d' sunilfile|sed 'w sunilfile'
CAUTION:-
1)Test it first on some dummy file
2)Never play around with passwd,shadow or group files

Please Respond back if it was of any use.


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: How to delete particular lines

how to rm a file '-' www.computing.net/answers/solaris/how-to-rm-a-file-/3536.html

how to count lines in binary files? www.computing.net/answers/solaris/how-to-count-lines-in-binary-files/3163.html

Limit users to a particular DIR tree. www.computing.net/answers/solaris/limit-users-to-a-particular-dir-tree/1257.html