Unix/Linux Go Back    

Replace space within quotes

Shell Programming and Scripting

Kindly Note - This is a Single User Post by Forum Member Scrutinizer Regarding:
Replace space within quotes.
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 11-14-2017   -   Original Discussion by SkySmart
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Join Date: Nov 2008
Last Activity: 21 January 2018, 10:39 AM EST
Location: Amsterdam
Posts: 11,711
Thanks: 531
Thanked 3,400 Times in 2,996 Posts

echo "'/var/FTPROOT/px/sci/archive/20171102070057904-DY_DC04_Daily Inventory Sync-en-us.csv' '/var/FTPROOT/px/sci/archive/20171102070058291-DY_DC07_Daily Inventory Sync-en-us.csv'" | 
awk '{for(i=2; i<=NF; i+=2) gsub(" ","*",$i)}1' FS=\' OFS=\'

You need the double quotes around the line with the single quoted paths, otherwise the single quotes will be interpreted and removed by the shell and never reach sed or awk.

That is, if you need to specify the paths on a single line

Last edited by Scrutinizer; 11-14-2017 at 03:22 AM..
The Following User Says Thank You to Scrutinizer For This Useful Post:
SkySmart (11-14-2017)