Re: SED: Insert Token at specific points
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 06/30/05
- Next message: Geoff Clare: "Re: How to fetch the date of all files in a directory"
- Previous message: Sven Mascheck: "Re: how to write portable shell scripts?"
- In reply to: Alan Connor: "Re: SED: Insert Token at specific points"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Jun 2005 11:04:15 GMT
On comp.unix.shell, in <PYPwe.13940$pa3.7929@newsread2.news.atl.earthlink.net>, "Alan Connor" wrote:
>
>
> On comp.unix.shell, in <42C3BDDB.90304@gmx.de>, "Thorsten Knopel" wrote:
>>
>>
>> Hello
>>
>> I hada little problem
>>
>> we Data (CSV) files with following schema
>>
>> DATA "Karl" "2" "OLGA" "4" "5" "6" "TOTO" ... "70"
>> DATA "1" "MEL" "URGA" "4" "SEPP" "6" "TOT" ... "70"
>>
>>
>> And we want insert empty values at position 3 and 5
>>
>> DATA "Karl" "2" "OLGA" "" "4" "5" "" "6" "TOTO" ... "70"
>> DATA "1" "MEL" "URGA" "" "4" "SEPP" "" "6" "TOT"... "70"
>
> sed -n 's/^\(DATA \)\(\"[^"]*\"\)\( \"[^"]*\" \)\(\"[^"]*\"\)\
> \( \"[^"]*\" \)\(\"[^"]*\"\)\ \(.*\)/\1\2 \3 \"\" \5 \"\" \
> \7/p' inputfile > outputfile
>
It just occurred to me that is probably a really long file. So
test it this way:
sed -ne 'what's inside the single quotes above' -e '200q' \
inputfile | less
AC
- Next message: Geoff Clare: "Re: How to fetch the date of all files in a directory"
- Previous message: Sven Mascheck: "Re: how to write portable shell scripts?"
- In reply to: Alan Connor: "Re: SED: Insert Token at specific points"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|