![]() |
|
|
|
|
|||||||
| 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 |
| char c = 882 | useless79 | High Level Programming | 1 | 07-30-2007 02:16 AM |
| char *p and char p[]. | arunviswanath | High Level Programming | 4 | 07-19-2006 11:11 PM |
| get the last 2 char from a variable | tads98 | Shell Programming and Scripting | 5 | 10-12-2005 08:45 PM |
| char array | avadhani | High Level Programming | 2 | 07-23-2005 08:52 PM |
| \n char in C | C|[anti-trust] | High Level Programming | 1 | 05-05-2005 03:15 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to replace any char with newline char.
Hi,
How to replace any character in a file with a newline character using sed .. Ex: To replace ',' with newline Input: abcd,efgh,ijkl,mnop Output: abcd efgh ijkl mnop Thnx in advance. Regards, Sasidhar |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
sed s/,/\\n/g file1 |
|
#3
|
|||
|
|||
|
Hi Prajith,
Its not working... the o/p is something like this abcdnefghn ... |
|
#4
|
|||
|
|||
|
notice that 2 slashes before 'n'
its Code:
sed s/,/\\n/g file1 Code:
sed s/,/\n/g file1 |
|
#5
|
||||
|
||||
|
Code:
sed 's/,/\ /g' _somefile > some_new file |
|
#6
|
||||
|
||||
|
try this
tr "," "\n" <input_file> Output |
||||
| Google The UNIX and Linux Forums |