![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our Members | 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 |
|
|||
|
Replace blank spaces with semicolon - text file
Hi all, Been trying to find a solution to this, I'm sure its a sed 1 liner, but I don't know sed well enough to work it out... I have a text file in the following format: Code:
431 666 1332 2665 0.24395
432 670 1340 2681 0.24544
433 674 1349 2697 0.24693
434 678 1357 2714 0.24844
435 683 1365 2730 0.24995
436 687 1373 2747 0.25148
437 691 1382 2763 0.25300
438 695 1390 2780 0.25454
etc.... there are a number of blank spaces between the columns, and I want to replace these blank spaces so that there is one single semi colon there instead. Any thoughts? Thanks Jon |
|
|||
|
there's a number of different ways you can do this, one example is cut/paste
cut f1 file > tmp1; cut f2 file > tmp2; cut f3 file > tmp3; etc etc paste tmp1 tmp2 tmp3 tmp4 > file rm -f tmp* something like that, 'man cut' for more info. also grep, awk, some cool loops, input field seperator... etc |
|
|||
|
Franklin, brilliant, thats exactly what I need, thanks!
|
| 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 |
| Removing blank spaces, tab spaces from file | NARESH1302 | Shell Programming and Scripting | 3 | 08-07-2009 12:18 PM |
| Remove blank spaces in a text file... | bhagya2340 | Shell Programming and Scripting | 4 | 03-01-2009 02:47 AM |
| how to remove blank spaces of a file with awk?? | pabloli150 | Shell Programming and Scripting | 4 | 02-26-2009 04:08 PM |
| Replace blank spaces by single tab, and right alignment | Jae | Shell Programming and Scripting | 1 | 08-08-2007 11:58 PM |
| Removing blank spaces from a file? | dfs | Shell Programming and Scripting | 4 | 05-22-2007 06:59 PM |