I have a file with records of 4 fields, each enclosed in double quotes & separated by commas. The first field may contain spaces, where it does I want the space to be converted to an underscore. Any spaces in other fields must remain.
I can figure out how to do this using awk (though my solution is very messy) but it must be possible to use sed to substitue only the spaces in the first field to underscores. Can anyone help? As an example here's what some lines may look like:
"1403078","00174013.tif","\\server name\directory name","Paybill162\134379"
"1403079","00174014.tif","\\server name\directory name","Paybill162\134379"
"1403080 1403086 1403087 1403088 1403089 1403090 1403091","00174015.tif","\\server name\directory name","Paybill162\134379"
"1403080 1403081 1403082 1403083 1403084 1403085 1403086 1403087 1403091","00174017.tif","\\server name\directory name","Paybill162\134379"
Thanks in advance
I can figure out how to do this using awk (though my solution is very messy) but it must be possible to use sed to substitue only the spaces in the first field to underscores. Can anyone help? As an example here's what some lines may look like:
"1403078","00174013.tif","\\server name\directory name","Paybill162\134379"
"1403079","00174014.tif","\\server name\directory name","Paybill162\134379"
"1403080 1403086 1403087 1403088 1403089 1403090 1403091","00174015.tif","\\server name\directory name","Paybill162\134379"
"1403080 1403081 1403082 1403083 1403084 1403085 1403086 1403087 1403091","00174017.tif","\\server name\directory name","Paybill162\134379"
Thanks in advance