[GLLUG] Appending text via shell script

Benjamin Minshall minshal1 at msu.edu
Wed Jun 22 16:17:10 EDT 2005


You probably just want plain old cat, grep and output direction.  Examples:

Put parts 1 and 2 together to form total:
$ cat file.part1 file.part2 > file.total

Append part2 to the end of part1
$ cat file.part2 >> file.part1

Put parts 1 and 2 together and search them:
$ cat file.part1 file.part2 | grep 'search string' > file.filtered

Document ion for the GNU textutils is a good place to look:
http://www.gnu.org/software/textutils/textutils.html

-Ben

Search files
Mike Szumlinski wrote:
> I'm starting to make packages for installs here at work and from time  
> to time I need to append text to a preference file rather than write  
> over it.  It does have to be called through a shell script (part of  the 
> requirements of an OS X .pkg file).  I'm new to command line text  
> manipulation and I'm not quite sure what tool/tools are going to work  
> best for me.  Basically I'll want to search various plist files (XML)  
> and append lines/delete lines from them from a shell script.  Anyone  
> have a good idea what direction to point me in?
> 
> -Mike
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user
> 



More information about the linux-user mailing list