Main Area and Open Discussion > General Software Discussion
anyone know a commandline tool to add a line of text to end of a text file?
rjbull:
Unix cat in various ports to Windows/DOS
Carol Haynes:
How about good old edlin (built in to DOS and WinXP Command Windows)
See Edlin Command Help
There is also mouse driven DOS command Edit
dajo:
Stefan mentioned SED and AWK, which are both command-line text manipulation tools. SED is the simplest, and is best used for regular expression search and replace. AWK is its own little programming language, and is a more powerful than SED, but much lighter than Perl.
I spent a lot of time exploring text manipulation tools a few years back. I ended up using AWK and Perl for most things, but then I found Datamystic's TextPipe Pro (shareware, $299) http://snipurl.com/leapfrog_textpipe, for it's power and ease of use. I became such a fan of the product that I have since become a reseller.
I might be able to work out a discount deal on TextPipe for DonationCoder members only... Mouser, I will contact you about this offline.
mouser:
textpipe really looks like a great application; probably even with a real discount it would be out of range for most of us but still any discount for our members would be welcome, and you might just make someone's day :) :up:
rjbull:
Stefan mentioned SED and AWK, which are both command-line text manipulation tools. SED is the simplest, and is best used for regular expression search and replace. AWK is its own little programming language, and is a more powerful than SED, but much -dajo (October 06, 2005, 08:21 AM)
--- End quote ---
Uh, I ended up feeling that SED was a bit like trying to use an early programmable calculator, and that AWK was actually easier simply because it's more like a recognisable language. Eric Pement has a good Web site for both and also for the kind of command line tools Stefan mentioned (go to his SED page and keep paging down);
Eric Pement's Web site; SED, Awk, Perl, search-and-replace utilities including useful supplementary information, help and workarounds for Minitrue / MT / MTR / Ministry of Truth under Windows 2000 / Win2K.
http://www.student.northpark.edu/pemente/index.htm
One set of Unix utils ported to Windows and including CAT is at
http://unxutils.sourceforge.net
Mouser, here's the online help for the Berkley utils version of cat, more informative than the GNU equivalent;
=== begin quote ===
usage: berkcat file(s)
Concatenates the file(s) to the standard output.
If one of the files is `-', the standard input is used.
No options.
Example:
C:>cat - file1 >newfile
this is the new first line
and this is the second.
^Z
C:>mv newfile file1
This is a way to add 2 lines to the beginning of file1 without using
an editor.
To append file1 at the end of file2, type
cat file1 >> file2
=== end quote ===
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version