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 3 Days Ago   -   Original Discussion by SkySmart
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 18 November 2017, 12:20 AM EST
Location: Amsterdam
Posts: 11,617
Thanks: 516
Thanked 3,380 Times in 2,979 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; 3 Days Ago at 03:22 AM..
The Following User Says Thank You to Scrutinizer For This Useful Post:
SkySmart (3 Days Ago)