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  
Moderator
 
Join Date: Nov 2008
Last Activity: 21 April 2018, 1:48 AM EDT
Location: Amsterdam
Posts: 11,781
Thanks: 542
Thanked 3,430 Times in 3,024 Posts
Try:


Code:
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 02:22 AM..
The Following User Says Thank You to Scrutinizer For This Useful Post:
SkySmart (11-14-2017)