Hi,

I have done some work on this script since my last post and I have used SED.

I came up with this (I know it's rough, but it does the job, nearly. I am
open for suggestions to simplify,though)

sed 's/BLUN/,BLUN/g' file1 | sed 's/^\([^,]*\),[^,]*,/\1,,/' | sed
's/BLUN/,BLUN/g' | sed 's/,,/,/g' | sed 's/,161/,,161/g' | sed
's/^\([^,]*\),[^,]*,/\1,,/' | sed 's/,,//g' | sed
's/^\([^,]*\),[^,]*,/\1,,/' | sed 's/,,/,/g' | sed
's/^\([^,]*\),[^,]*,/\1,,/' | sed 's/,,/,/g' | sed
's/^\([^,]*\),[^,]*,/\1,,/' | sed 's/,,/,/g' | sed
's/^\([^,]*\),[^,]*,/\1,,/' | sed 's/,,/,/g' > file2

I am now faced with a linebreak, which I have to convert to a comma. What
would I have to do?

Bernhard L�der

This electronic mail is solely for the use of the addressee and may contain
information that is confidential or privileged.  If you receive this
electronic mail in error, please delete it from your system immediately and
notify the sender by electronic mail.




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Bernhard L�der
Sent: Friday, January 04, 2002 4:44 PM
To: SLUG user group
Subject: [SLUG] help for script


Hi,

I need to convert 2 lines of data to one.

This is the data I can extract from the data base:
FIXEDdata1,Flexibledata1,Neededdata1
FIXEDdata1,Flexibledata2,Flexibledata3,Flexibledata4,Flexibledata5,Flexibled
ata6,Flexibledata7,Neededdata2,Neededdata3,Flexibledata8

This is the data I want to use in a comma separated from:
Neededdata1,Neededdata2,Neededdata3

How can I strip off the FIXEDdata and the Flexibledata so I only keep the
Neededdata?

There is always multiple double lines of data with some single lines, like:
FIXEDdata1,Flexibledata1,Neededdata1
FIXEDdata1,Flexibledata1,Neededdata1
FIXEDdata1,Flexibledata1,Neededdata1
FIXEDdata1,Flexibledata2,Flexibledata3,Flexibledata4,Flexibledata5,Flexibled
ata6,Flexibledata7,Neededdata2,Neededdata3,Flexibledata8
FIXEDdata1,Flexibledata1,Neededdata1
FIXEDdata1,Flexibledata2,Flexibledata3,Flexibledata4,Flexibledata5,Flexibled
ata6,Flexibledata7,Neededdata2,Neededdata3,Flexibledata8
FIXEDdata1,Flexibledata1,Neededdata1
FIXEDdata1,Flexibledata2,Flexibledata3,Flexibledata4,Flexibledata5,Flexibled
ata6,Flexibledata7,Neededdata2,Neededdata3,Flexibledata8
.........

where do I start?
Bernhard L�der

This electronic mail is solely for the use of the addressee and may contain
information that is confidential or privileged.  If you receive this
electronic mail in error, please delete it from your system immediately and
notify the sender by electronic mail.



--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to