![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Of bash and whitespace... | lev_lafayette | Shell Programming and Scripting | 2 | 04-13-2008 05:44 PM |
| Delete whitespace | truck7758 | Shell Programming and Scripting | 12 | 12-05-2007 08:00 AM |
| sed : remove whitespace | b.hamilton | Shell Programming and Scripting | 3 | 11-06-2007 07:02 AM |
| trim whitespace? | msteudel | Shell Programming and Scripting | 4 | 07-07-2005 04:57 PM |
| remove whitespace and test | bensky | Shell Programming and Scripting | 4 | 09-25-2003 05:02 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
sed and whitespace characters
I have teh follwing details in a file:
SmithA..... ,,400 JonesA..... ,,300 JamesA..... ,,600 BakerA ,,800 ChrisA ,,1200 the first field name is 6 characters in length always and alays ends with an 'A'. The periods denote white space (space caharacters), as you can see on certain occurences ther are many 'spaces' and in other instances no 'spaces'. I want to be able to make the above file as below: SmithA. ,,400 JonesA. ,,300 JamesA. ,,600 BakerA. ,,800 ChrisA. ,,1200 So anly one single whitespace is present after the las 'A' character. I have treied the following, sed 's/ *//g' fileA > fileB which gives me: SmithA ,,400 JonesA ,,300 JamesA ,,600 BakerA ,,800 ChrisA ,,1200 however i am now not so sure how to put a whitecase character back in after the A to get the format as required above. Could anyone assist, also would perferably be ideal if i could have the whole thing processed in one single sed command. |
| Forum Sponsor | ||
|
|
| Thread Tools | |
| Display Modes | |
|
|