×
UNIX.COM Login
Username:
Password:  
Show Password





×
UNIX.COM Login
Hello Unregistered
Welcome from United States
You are somewhere around Ashburn
Last Visit: 1 Minute Ago @ 03:25 PM
Bits: 0
UNIX Time: 1531682706

👤


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 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: 14 July 2018, 11:07 PM EDT
Location: Amsterdam
Posts: 11,853
Thanks: 546
Thanked 3,469 Times in 3,057 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)