TECH SOLUTIONS

Click here to edit subtitle

Forums

Post Reply
Forum Home > Unix Learnings > Unix Shell Script: Remove invalid control characters(ctrl-a,ctrls-m) etc from file

Sourav Gulati
Site Owner
Posts: 83

Following is  an example file :


$ cat test

row-1[]colfam1[]quan1[]val1

row-2[]colfam1[]quan2[]val2

 

It has control characters between lines.


Following is the way to remove these characters from file.


$ cat test | tr  -c "[:print:]^\n" " "

row-1 colfam1 quan1 val1

row-2 colfam1 quan2 val2





February 15, 2013 at 12:59 AM Flag Quote & Reply

You must login to post.