bergman on 31 Aug 2010 08:51:47 -0700


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

Re: [PLUG] Sed or awk help?!


The pithy ruminations from linc <linc@lincgeek.org> on "Re: [PLUG] Sed or awk help?!" were:

=> Daniel.Roberts@sanofi-aventis.com wrote:
=> > Hello
=> > It has been a VERY long time that I have done any scripting..
=> > So if you would..could you please help me out??
=> > I have a file 1.7 million lines long..
=> > It contains nothing but filenames with a .CEL extension..
=> > What I need to do is prepare another file of the same type but with the
=> > .CEL file extension ripped out..
=> > How can I do this in sed/awk?
=> > Thanks for any help!
=> > Dan
=> > ___________________________________________________________________________
=> > 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
=> 
=> tr -d ".CEL" < original.file > new.file
=> 



NO.


Please see:
	man tr




The command given above will delete any of the characters "." "C", "E", "L". For example:

-----------ORIGINAL FILE----------------------------
The following line should be changed:
	the incorrect filename is: foobar.CEL


None of these lines should be changed:
	the Audi had unintended ACCELERATION
	this is a CELL culture
	the tumor was ACELLULAR

	The letters "C", "E", and "L" should not be removed UNLESS they are
	in the filename EXTENSION ".CEL", and it occurs ONLY at the END of
	a LINE.
----------------------------------------------------


-----------OUTPUT FROM tr---------------------------
The following line should be changed:
	the incorrect filename is: foobar


None of these lines should be changed:
	the Audi had unintended ARATION
	this is a  culture
	the tumor was AUAR

	The letters "", "", and "" should not be removed UNSS they are
	in the filename XTNSION "", and it occurs ONY at the ND of
	a IN
----------------------------------------------------

Mark
___________________________________________________________________________
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