|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Appending a character(#) with string search at the start of the line
Hello, I have been browsing through the forum, but unable to find a solution for my requirement. I need to go through a file and search for Code:
/home/users and insert a # symbol at the start Code:
/home/users . Example output is Code:
#/home/users . Can you please help me with the awk or sed command for this.Thank you. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
try: Code:
sed -i '/\/home\/users/s/^/#/' infile |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search several string and convert into a single line for each search string using awk command AIX?. | laknar | Shell Programming and Scripting | 5 | 12-09-2012 06:33 PM |
| Search for a string, then append character to end of that line only | snoman1 | Shell Programming and Scripting | 1 | 11-27-2012 01:25 PM |
| Appending # to the start of specific line in a properties file | mihirvora16 | UNIX for Advanced & Expert Users | 6 | 09-16-2011 11:57 AM |
| Appending string, variable to file at the start and string at end | Vaddadi | Shell Programming and Scripting | 4 | 03-24-2010 01:31 PM |
| appending string to text file based on search string | malaymaru | Shell Programming and Scripting | 1 | 06-09-2006 08:53 AM |
|
|