Looking to take an input file that is not in the proper format and
change the file to the proper format.
current format is: 1234-7654321 Characters - more chars,1234
I am able to do what I need in multiple iterations of a file, but what
I really would like is to change the file in one pass.
requested format: 1234|7654321|Characters|1234|today's date|more characters
currently have:
echo ' {print substr($1,1,4) "|" substr($1,6,7) "|"}
' > ./awkscript.txt
awk -f ./awkscript.txt ./datafile > datafile.new
looking for a regular expression using awk or any other suggestions that will work...
I am able to parse the first 2 fields, but I am very new to awk and having a bit of trouble with the syntax of reg expression pattern matching...I would think using a reg expression getting the $2 up the the comma delimiter would be the next step...any help would be great
Thanks
change the file to the proper format.
current format is: 1234-7654321 Characters - more chars,1234
I am able to do what I need in multiple iterations of a file, but what
I really would like is to change the file in one pass.
requested format: 1234|7654321|Characters|1234|today's date|more characters
currently have:
echo ' {print substr($1,1,4) "|" substr($1,6,7) "|"}
' > ./awkscript.txt
awk -f ./awkscript.txt ./datafile > datafile.new
looking for a regular expression using awk or any other suggestions that will work...
I am able to parse the first 2 fields, but I am very new to awk and having a bit of trouble with the syntax of reg expression pattern matching...I would think using a reg expression getting the $2 up the the comma delimiter would be the next step...any help would be great
Thanks