From: Okonita via DBMonster.com on
Hi all,
Working on a little shell script to remove specific records from a flat file.
I have scanned a one or two script books and googled for answers but have no
success. Can someone show me how I can do this. For example, how can I remove
the something like the following records from among 200 other records:
DB2ADMIN.EPISODE_1;
DB2ADMIN.EPISODE_2;
DB2ADMIN.EPISODE_3;
DB2ADMIN.EPISODE_4;
DB2ADMIN.EPISODE_5;
DB2ADMIN.EPISODE_6;
DB2ADMIN.EPISODE_7;

You see, they are not duplicates, so uniq will not do the job. Is there
another keyword that can remove something lke these given a string such as '
DB2ADMIN.EPISODE_%' in a shell script?
I'll truly appreciate any help I can get on this...

Thanks

--
Message posted via http://www.dbmonster.com

From: Lennart on
On Jun 22, 11:32 am, "Okonita via DBMonster.com" <u36825(a)uwe> wrote:
> Hi all,
> Working on a little shell script to remove specific records from a flat file.
> I have scanned a one or two script books and googled for answers but have no
> success. Can someone show me how I can do this. For example, how can I remove
> the something like the following records from among 200 other records:
> DB2ADMIN.EPISODE_1;
> DB2ADMIN.EPISODE_2;
> DB2ADMIN.EPISODE_3;
> DB2ADMIN.EPISODE_4;
> DB2ADMIN.EPISODE_5;
> DB2ADMIN.EPISODE_6;
> DB2ADMIN.EPISODE_7;
>
> You see, they are not duplicates, so uniq will not do the job. Is there
> another keyword that can remove something lke these given a string such as '
> DB2ADMIN.EPISODE_%' in a shell script?
> I'll truly appreciate any help I can get on this...
>

grep -v is probably what you are looking for. Something like:

grep -v DB2ADMIN.EPISODE_ < infile > outfile

should do the trick


/Lennart


> Thanks
>
> --
> Message posted viahttp://www.dbmonster.com

From: Lennart on
On Jun 22, 12:15 pm, Lennart <Erik.Lennart.Jons...(a)gmail.com> wrote:
> On Jun 22, 11:32 am, "Okonita via DBMonster.com" <u36825(a)uwe> wrote:
>
>
>
> > Hi all,
> > Working on a little shell script to remove specific records from a flat file.
> > I have scanned a one or two script books and googled for answers but have no
> > success. Can someone show me how I can do this. For example, how can I remove
> > the something like the following records from among 200 other records:
> > DB2ADMIN.EPISODE_1;
> > DB2ADMIN.EPISODE_2;
> > DB2ADMIN.EPISODE_3;
> > DB2ADMIN.EPISODE_4;
> > DB2ADMIN.EPISODE_5;
> > DB2ADMIN.EPISODE_6;
> > DB2ADMIN.EPISODE_7;
>
> > You see, they are not duplicates, so uniq will not do the job. Is there
> > another keyword that can remove something lke these given a string such as '
> > DB2ADMIN.EPISODE_%' in a shell script?
> > I'll truly appreciate any help I can get on this...
>
> grep -v is probably what you are looking for. Something like:
>
> grep -v DB2ADMIN.EPISODE_ < infile > outfile
>
> should do the trick
>

Another option is of course to use sed:

sed -e "/DB2ADMIN.EPISODE_/d"

A third to use awk/perl/python/ruby/...
From: Okonita via DBMonster.com on
Hello again Lennart,

Thanks for chipping in...I think I have it now




Lennart wrote:
>> Hi all,
>> Working on a little shell script to remove specific records from a flat file.
>[quoted text clipped - 13 lines]
>> DB2ADMIN.EPISODE_%' in a shell script?
>> I'll truly appreciate any help I can get on this...
>
>grep -v is probably what you are looking for. Something like:
>
>grep -v DB2ADMIN.EPISODE_ < infile > outfile
>
>should do the trick
>
>/Lennart
>
>> Thanks
>>
>> --
>> Message posted viahttp://www.dbmonster.com

--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums.aspx/ibm-db2/200806/1