kphillips1
asked on
need to enter dashs into a string of characters "123456789" using sed result s/b "123-45-6789"
Have an ascii file that contains lines of data in the format:
12345~123456789~
12346~023456789~
Need to place dashes into send string of numbers to format a social security number
123-45-6789
023-45-6789
Would like to do this on the command line using sed, if possible. The data would be piped to the sed command.
12345~123456789~
12346~023456789~
Need to place dashes into send string of numbers to format a social security number
123-45-6789
023-45-6789
Would like to do this on the command line using sed, if possible. The data would be piped to the sed command.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
so you want the output to remove the trailing ~?
then:
sed -e 's/\(~...\)\(..\)\(....\)~ /\1-\2-\3/ ;'
then:
sed -e 's/\(~...\)\(..\)\(....\)~
ASKER
The data is a listing of client ids and there order numbers