regex - Replacing with SED, trying to append content doesn't work -
I'm trying to use sed to fix a file, and I'm doing wrong. There is no indication that why the SED is not behaving as I hope it will be appreciated.
My file contains a bunch of a line, each has a single value. The content of values is irrelevant to the replacement, save it that they are always alpha-numeric and follow a pattern.
P> sed 's /\(.*\)/ NULL; 0; 400; 6; 2010-07-27; Results in: 1 / 'selection.csv
:
NULL; 0; 400; 6; 2010-07-27; 1326 GP11 SHH Naul; 0; 400; 6; 2010-07-27; 2312bb30mm Attachments (unsuccessful) However, when joined, things get ugly:
< Code> sed 's / \ (. * \) / \ 1; Null; Null; Results in 1 / 'selection.csv
:
; NULL; NULL; 1 2312BB30DUM; NULL; NULL; 1
On the last line, except for everyone, is quite disappointing.
It should be quite clear that I am doing wrong here, but I can not understand it.
(Note: It is not sure whether it is SO or SU content ... feel free to move it to Superuser, if you can and can assume that it should be there) < /p>
Do a dos2unix on the first file, then use the sed
$ Dos2unix file $ sed 's / $ /; NULL; NULL; 1 / 'file
Comments
Post a Comment