Need to remove / (slash) and replace ; (semi-colon) with new line
Hi,
I am new to unix. and I need to have a shell script which does the following, 1. Remove '/' in the file 2. Replace ';' with new line Input file (sample): TL/01039;TL/07014;TL/07016;TL/07046;TL/09476;TL/09522 Output file should be: TL01039 TL07014 TL07016 TL07046 TL09476 TL09522 Can someone help on this?. I would appreciate if steps involved are explained. Thanks Rakesh |
You can use tr to change the semi-colons into newline characters. Look at the man page for tr ("man tr") to see how to use it.
To remove the slashes, you can use sed. You might want to look at this tutorial for sed (particularly the "The essential command: s for substitution" section). Pipes are also useful for this task. |
You could try a simple awk:
Code:
awk 'gsub("/","")' RS=";" file |
All times are GMT -5. The time now is 10:24 PM. |