|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can sed strip single quotes?
I am formatting a list of names for a mySQL query and some names have single quotes in them that throw off the query.
Like for instance 'Bob, D'beers' would only yield 'Bob, D' since the single quote in the name ends the field. So I have searched all over for a way to have sed remove all single quotes in my file before I format my list for mySQL. in my script i have: sed '/\'//g' tmp.txt' > strippedQuotes.txt and it complains 'unexpected EOF while looking for matching "'" '. Is this possible? There must be some sort of metacharacter to represent single quotes or something. |
|
#2
|
||||
|
||||
|
Code:
sed "s/'//g" file.txt > file2.txt works great for me. Note the use of double quotes to contain the regular expression.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Thanks alot, exactly what I was looking for!
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Can sed strip single quotes? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|