![]() |
|
|
|
|
|||||||
| 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 |
| strip first 4 and last 2 lines from a file using perl | meghana | Shell Programming and Scripting | 10 | 02-01-2008 06:01 PM |
| How to strip non numerical data out of file? | Juha | Shell Programming and Scripting | 10 | 01-09-2007 04:09 AM |
| How to strip the contants from a file | isingh786 | UNIX for Dummies Questions & Answers | 2 | 12-16-2005 04:11 PM |
| how to strip out the contents of file using grep | isingh786 | UNIX for Dummies Questions & Answers | 11 | 11-28-2005 04:09 PM |
| trying to strip the first 4 char. of a file out via commandline | Optimus_P | UNIX for Dummies Questions & Answers | 2 | 06-12-2001 10:02 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to strip apostrophe from a file
I am trying to remove or replace various extraneous characters from a file so that subsequent processes work correctly. The characters that is giving me trouble is the apostrophe '.
The command I 'm trying is sed 's/\'//g' ${IN_WRK_DIR}/file1 > ${IN_WRK_DIR}/file2 in a Korn script on HP Unix. I do need to retain other nonalpha-numeric characters. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Check out this URL...it had helped me sometime back. I came across something similiar.
http://answers.google.com/answers/threadview?id=496910 Vino |
|
#3
|
|||
|
|||
|
Sometimes tr is easier to use than sed for single characters:
Code:
cat filename | tr -s "\'" ' ' |
|
#4
|
||||
|
||||
|
Quote:
tr -s "\'" ' ' < filename </UUOC police> |
|
#5
|
|||
|
|||
|
Thanks for the suggestions
tr works like a charm. As always syntax is everything.
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
||||
|
||||
|
But in using cat you cat have to make fork and exec system calls for the new process, both are expensive calls, by using < to redirect stdin you do not need to make these calls and so as vergsh99 pointed out it would be a UUOC.
Why do you think it would be any different if it were sed? |
||||
| Google The UNIX and Linux Forums |