|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | 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 | Display Modes |
|
#1
|
|||
|
|||
|
replacing by sed
hi
my input file has got >,,,, or >, or >,,,,,, there are independent number of commas after >.... i want the o/p as > only that is just to remove "," after">" another is: i want to replace the last line of the file and to replace it by "hello"...how to do?... any nice script plz help |
| Sponsored Links | |
|
|
|
#2
|
|||
|
|||
|
Data File Example: Code:
$ cat data Knight Eon >,,,, Hello World >,, Hello Earth > How is everyone >,,,,,, Around >,, Yo >, The relevant SED Script: Code:
sed -e 's/>,*/>/g' data Output: Code:
$ sed -e 's/>,*/>/g' data Knight Eon > Hello World > Hello Earth > How is everyone > Around > Yo > Combining your second query: Code:
$ sed -e 's/>,*/>/g;$s/.*/Hello/g' data Knight Eon > Hello World > Hello Earth > Hello Last edited by knight_eon; 02-07-2012 at 01:22 AM.. Reason: Updated for second query |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
hi all,
thanks alot ....it worked!!!!! gr8 efforts.......highly appreciate all of your help and efforts |
| 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 |
| replacing ' with '' using sed | DushyantG | Shell Programming and Scripting | 7 | 03-31-2011 04:52 AM |
| Replacing \n,\n with , | skerit | Shell Programming and Scripting | 7 | 12-10-2008 10:56 AM |
| replacing using sed | shailesh_arya | Shell Programming and Scripting | 2 | 07-11-2008 12:06 AM |
| replacing with `pwd` | oldtrash | Shell Programming and Scripting | 6 | 04-09-2004 06:24 PM |
| replacing \n by \r\n | crashnburn | UNIX for Dummies Questions & Answers | 3 | 11-24-2003 02:49 PM |
|
|