Eric at Lucii.org on 31 Aug 2010 11:13:45 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Sed or awk help?!


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Heh, nothing like a good command line question to fire up the list!

Adding my 2 cents here:

I wholeheartedly support Walt's solution:

On 08/31/2010 12:09 PM, Walt Mankowski wrote:
> On Tue, Aug 31, 2010 at 12:03:49PM -0400, linc wrote:
>> DOH!  Yeah, you are right.  Have to use something like:
>>
>> sed 's/.CEL//' filename > newfile
>> instead...
>
> That's still not quite right.  You should escape the period and anchor
> the end of the string.  This is better:
>
> sed 's/\.CEL$//' filename >newfile
>

You are dealing with 1.7 million records so it's difficult if not impossible to
check for errors like foo.CEL.bar.CEL

Even if you are "sure" it won't happen why risk it when it's so easy to specify
_precisely_ what it is you want to remove as Walt did in his sed command, above.


Eric

On 08/31/2010 01:49 PM, Daniel.Roberts@sanofi-aventis.com wrote:
> Actually..
> Here is a small snippet of the huge file that I am trying to process
> 
> Note that the filename is always in the fifth column of a tab delimited
> file...and the filename itself could contain periods....but it will
> always end in the ".CEL" filename extension which is what I am looking
> to remove...
> The filename has many different conventions, it may contain any
> combination of numbers and letters, but always ends in a .CEL file name
> extension...
> So If I could re-write the same file w/o the .CEL extensions that would
> be great!
> Dan
> 
> 
> 
> 10	3EDD188D-91D3-4104-8992-E12D4B5F4785	3242
> AFFY_LIMS_DATA_OLD	012799Kas19KA85305_26.CEL
> \\DGMappafs01\archivedata\1999
> 11	3EDD188D-91D3-4104-8992-E12D4B5F4785	3243
> AFFY_LIMS_DATA_OLD	012799Kas19KA85305_33.CEL
> \\DGMappafs01\archivedata\1999
> 12	3EDD188D-91D3-4104-8992-E12D4B5F4785	3244
> AFFY_LIMS_DATA_OLD	020599Kas19KA04.CEL
> \\DGMappafs01\archivedata\1999
> 13	3EDD188D-91D3-4104-8992-E12D4B5F4785	3245
> AFFY_LIMS_DATA_OLD	020599Kas19KA06.CEL
> \\DGMappafs01\archivedata\1999
> 14	3EDD188D-91D3-4104-8992-E12D4B5F4785	3246
> AFFY_LIMS_DATA_OLD	020599Kas19KA01.CEL
> \\DGMappafs01\archivedata\1999
> 15	3EDD188D-91D3-4104-8992-E12D4B5F4785	3247
> AFFY_LIMS_DATA_OLD	012799Kas19KA85305_29.CEL
> \\DGMappafs01\archivedata\1999
> 16	3EDD188D-91D3-4104-8992-E12D4B5F4785	3248
> AFFY_LIMS_DATA_OLD	020599Kas19KA07.CEL
> \\DGMappafs01\archivedata\1999
> 17	3EDD188D-91D3-4104-8992-E12D4B5F4785	3249
> AFFY_LIMS_DATA_OLD	020599Kas19KA08.CEL
> \\DGMappafs01\archivedata\1999
> 18	3EDD188D-91D3-4104-8992-E12D4B5F4785	3250
> AFFY_LIMS_DATA_OLD	020599Kas19KA03.CEL
> \\DGMappafs01\archivedata\1999
> 19	3EDD188D-91D3-4104-8992-E12D4B5F4785	3251
> AFFY_LIMS_DATA_OLD	020899Kas19KA02.CEL
> \\DGMappafs01\archivedata\1999
> 20	3EDD188D-91D3-4104-8992-E12D4B5F4785	3252
> AFFY_LIMS_DATA_OLD	020999Kas19KC06.CEL
> \\DGMappafs01\archivedata\1999
> 21	3EDD188D-91D3-4104-8992-E12D4B5F4785	3253
> AFFY_LIMS_DATA_OLD	020999Kas19KC03.CEL
> \\DGMappafs01\archivedata\1999
> 22	3EDD188D-91D3-4104-8992-E12D4B5F4785	3254
> AFFY_LIMS_DATA_OLD	020899Kas19KA04.CEL
> \\DGMappafs01\archivedata\1999
> 23	3EDD188D-91D3-4104-8992-E12D4B5F4785	3255
> AFFY_LIMS_DATA_OLD	020899Kas19KA07.CEL
> \\DGMappafs01\archivedata\1999
> 24	3EDD188D-91D3-4104-8992-E12D4B5F4785	3256
> AFFY_LIMS_DATA_OLD	020999Kas19KA07.CEL
> \\DGMappafs01\archivedata\1999
> 25
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
> 

- -- 
#  Eric Lucas
#
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx9RiEACgkQ2sGpvXQrZ/4aLwCg+T5UR7zG9hQ3rosntkb8AM5q
PrIAoIcMM/56seDNGYKdAkkrx+i0Ae0b
=0Pvv
-----END PGP SIGNATURE-----
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug