Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

unix and linux commands - unix shell scripting

Batch file to remove double quotes from a file

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-11-2010
akashtcs akashtcs is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 17 August 2010, 7:45 AM EDT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Batch file to remove double quotes from a file

Hi

I have to create a windows batch file which will read an input file and remove "double quotes" from each line of the file.
For eg.If input file name is abcd.csv and contents is :


Code:
"asasd,123123,213213,asd"
"esfrf,dsfsdf,234324,sdfsdf"

Then the batch file should remove "" from the start and end of the line and output file should be:

Code:
asasd,123123,213213,asd
esfrf,dsfsdf,234324,sdfsdf

Plz help
Thanks
Sponsored Links
    #2  
Old Unix and Linux 01-11-2010
dinjo_jo dinjo_jo is offline
Registered User
 
Join Date: May 2008
Last Activity: 13 December 2011, 4:12 AM EST
Posts: 232
Thanks: 1
Thanked 6 Times in 5 Posts
sed 's/"//g' filename
Sponsored Links
    #3  
Old Unix and Linux 01-11-2010
akashtcs akashtcs is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 17 August 2010, 7:45 AM EDT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
I have to use a windows batch file to execute this.
This command is used in Unix I guess..
Thanks
    #4  
Old Unix and Linux 01-11-2010
EAGL€ EAGL€ is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 22 April 2016, 2:28 AM EDT
Location: izmir
Posts: 331
Thanks: 33
Thanked 13 Times in 13 Posts
Akashtcs you can even use a unix machine to remove double quotes, first transferring ur file to unix machine then applying above SED command. Then FTP ur csv files to windows machine. Once i needed to substitute "/" with "\\" as windows accept "\\" instead of "/" in property files and i used this method Linux
Sponsored Links
    #5  
Old Unix and Linux 01-11-2010
rdcwayx rdcwayx is offline Forum Advisor  
Use nawk in Solaris
 
Join Date: Jun 2006
Last Activity: 13 September 2015, 8:58 PM EDT
Posts: 2,759
Thanks: 44
Thanked 419 Times in 407 Posts
Do you have perl in your windows server?


Code:
perl -i.bak -pe 's/"//g' file.bat

Sponsored Links
    #6  
Old Unix and Linux 01-11-2010
akashtcs akashtcs is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 17 August 2010, 7:45 AM EDT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
No dont have perl in the system,
Also cant do it by transferring the file to unix and doing it...Linux
There must be something simple in windows to read file line by line and replace a character.
Sponsored Links
    #7  
Old Unix and Linux 01-11-2010
xoops xoops is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 17 June 2016, 9:07 AM EDT
Posts: 124
Thanks: 0
Thanked 7 Times in 7 Posts
You can download sed for windows and use above mentioned sed command, you can find sed for windows here
Sponsored Links
Closed


Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
replace value with double quotes of specific coulmn value in csv file techmoris Shell Programming and Scripting 3 08-03-2009 10:37 PM
Removing double quotes in a file kingofprussia UNIX for Dummies Questions & Answers 3 12-19-2008 05:28 AM
How to remove a character which is enclosed in Double quotes mohan_tuty UNIX for Advanced & Expert Users 3 06-16-2008 12:55 PM
Remove double quotes deepakwins UNIX for Dummies Questions & Answers 3 05-30-2008 12:53 PM
Double quotes or single quotes when using ssh? password636 Shell Programming and Scripting 3 05-29-2008 09:52 PM



All times are GMT -4. The time now is 01:38 AM.