![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replacing a line in a file - HELP!!! | maxmave | Shell Programming and Scripting | 1 | 06-04-2008 08:55 PM |
| Replacing end of line with " in a UNIX file | The Observer | Shell Programming and Scripting | 2 | 05-17-2008 02:20 AM |
| replacing a line of unknown charecters in a file | malavm | Shell Programming and Scripting | 12 | 07-26-2007 01:25 AM |
| Replacing characters in file with line break | johnemb | Shell Programming and Scripting | 10 | 04-26-2007 04:38 AM |
| replacing first line or lines in a file | Terrible | UNIX for Advanced & Expert Users | 3 | 06-28-2006 05:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I ahve a file where the format is as given below: qqq dfsf gdfjkg gjdosjg jkflsjd 21 fdksdlf fsdnkfl lkdfsgjld 45 laefsdl fsdlfksl fsdklflk gfsdl 56 I need to replace the last number by space or delete the last number in each line. (by using awk/sed/grep) Can U please help me with this . thanks in advance Js |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Dear jisha,
u can try this sed 's/[0-9]*$//' filename Regards, Pankaj |
|
#3
|
|||
|
|||
|
Thank you so much Pankaj
Its working Js |
|
#4
|
|||
|
|||
|
hi
i m not geeting any command for writing data in any existing file at end of file though linux commands.plz suggest me anything for it. kranti |
|
#5
|
|||
|
|||
|
Parser failed; syntax error at line 1.
|
|
#6
|
|||
|
|||
|
Code:
awk '{for(i=1;i<=NF-1;i++){printf("%s ",$i)};print "";}' filename
|
|
#7
|
||||
|
||||
|
hello kranti,
You can just append command output to the file like, Code:
command >> filename |
||||
| Google The UNIX and Linux Forums |