![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A Different Kind of DoS Attack | iBot | IT Security RSS | 0 | 09-17-2008 11:30 AM |
| Kind of knapsack problem | ngungo | Shell Programming and Scripting | 3 | 11-08-2007 09:35 AM |
| Kind of weird question | Cyberaxe | UNIX for Dummies Questions & Answers | 2 | 07-26-2005 06:19 PM |
| what kind of UNIX | hiei | UNIX for Dummies Questions & Answers | 2 | 04-12-2004 08:15 PM |
| Some kind of message command | sanjit | UNIX for Dummies Questions & Answers | 3 | 12-14-2000 10:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
sed help,,kind of urgent!!
Hello All,
My problem is: I want to replace a line from a file with sed. The first word in that line is always the same in every server. The second line is server model, which of course will vary from platform to platform and I need to leave that word as it is. After the second word, I need to add two words at the end of that line. example: serverName Sun-Fire 200 (this is by default) lets say if the server model is V480, then my output should be: serverName V480 (test server) (comment ![]() thanks in advance guys!! |
|
||||
|
Your description is a little confusing. Do you need to alter the second word, the second line, or the second word on the second line?
In any case, you can do this very simply with a Perl one-liner using the $. variable (which is the current line number) and a regular expression. Please post sample input and sample output from that input if you'd like me to give you the one-liner. That is, if you're open to a Perl solution. |
|
||||
|
May be I will stick to korn shell for the time being.
Here is my simple question, original content of a particular line in a file: sysdescr Sun SNMP Agent, Sun-Fire-T2000 I need to modify the above line with: sysdescr Sun SNMP Agent, Sun-Fire-T2000 - abcd - wxyz All I want is add (- abcd - wxyz) at the end of this line in a file using sed. thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|