|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Need sed command with an exception
All,
I am currently using the below code to add a line /var/temp/'$input1'/permissions Below is the shell :: sed ' /Unix_command/ a\ unix: /var/temp/'$input1'/permissions' temp1.txt> temp2.txt above will add the line below Unix_command word unix: /var/temp/'$input1'/permissions where as input 1 == unixid to all in the output file (temp2.txt) . But i dont need to add the lines to certain lines in that file .. can you provide me the shell which can exclude the above line when i am passing it using a Parameter file . Basically it should read from the parameter file and it should not add the line to the output file (temp2.txt) Example :: if the parameter file has a word unix_dump then it should not add the line to the output file . Below is the example :: unix_dump=a Unix_command=s Please Note :: Unix_command is a command word and it will be there in the input file (temp1.txt) . Thanks for your Help .. Raghav |
| Sponsored Links |
|
|
|
|||
|
I tried to fix the code, but not able to get the results. can anyone help me on this ???
|
|
|||
|
Quote:
more param.txt Code:
unix_dump more temp.txt[[[ which is the input file ]]] Code:
unix_core=a unix: /var/temp/unixid/permissions unix_dump=c unix: /var/temp/unixid/permissions Expected Output :: ====================================== Code:
unix_core=a unix: /var/temp/unixid/permissions Unix_command unix_dump=c unix: /var/temp/unixid/permissions ======================================= It should not add the word Unix_command which are mentioned in the Param file. The below which i am using will add the word to all Code:
sed ' /Unix_command/ a\ unix: /var/temp/unixid/permissions' temp1.txt> temp2.txt Last edited by vgersh99; 07-06-2009 at 05:31 PM.. Reason: code |
| Bits Awarded / Charged to raghav1982 for this Post | |||
| Date | User | Comment | Amount |
| 07-06-2009 | vgersh99 | added code tags - charged 10K bits | -10,000 |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exception Handling | bertpereira | Shell Programming and Scripting | 5 | 01-14-2009 09:28 PM |
| Handling "command not found" exception | nsharath | Linux | 5 | 12-18-2008 03:29 AM |
| MMU exception | Puntino | Linux | 2 | 05-07-2008 01:35 PM |
| Help with RPC Exception | ejbrever | HP-UX | 2 | 08-24-2006 03:08 PM |
| RPC Exception - Help | ejbrever | UNIX for Advanced & Expert Users | 0 | 08-21-2006 01:56 PM |