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?
mouser:
anyone know a commandline tool to add a line of text to end of a text file?
e.g.
--- ---addlinetofile.exe "c:\notes.txt" "this is a line of text to add"
i could code this easily enough and it would probably be 2 lines of perl but i wonder if anyone knows any existing tools to do this, maybe with some extra functionality?
dajo:
how about
echo "this is a line of text to add" >> c:\notes.txt
--- End quote ---
mouser:
thanks dajo, i'm always overlooking the simplest solutions :)
but still i can't help but wonder if there are some existing tools that offer some more functionality i might not have even thought of yet..
AbteriX:
a few Text manipulation tools i know (and try to use):
* DOS (like dajo's)
* sed
* awk
* Title : FILTER
Version : 4.0
Date : Mar 24,2000
Author : J.R. Ferguson, Amsterdam, The Netherlands
Download: http://hello.to/ferguson (DOS Filters)
Usage : FILTER [[<]in] [>out] [/option[...]] [...]] [txtopt [...]]
option: C[n,s,d] Copy n characters from position s to d.
D[n,p] Delete n characters at position p.
E[+/-][n] Expand tabs ([+]) or replace spacegroups by tabs (-),
where n [8] is tab field length.
F[n,m] Fill nonblank lines with dots to width n [70],
skipping first m [0] lines. Implies /T.
H Send this help text to (redirected) output.
? Send this help text to screen (page by page)
I[n,p] Insert n spaces at position p.
J[+/-] Add/remove Carriage Return before Line Feed [+].
L[+/-] Add/remove Line Feed after Carriage Return [+].
M[n,s,d] Move n characters from position s to d.
N[n] Number lines, use n [4] digits,
O[n,s,d] Overwrite n chars from position s to d.
P Reset parity bit. Implied by /W.
R[n] Remove n trailing lines after processing /S and /X.
S[n,m] Skip m lines starting at line n.
T Trim trailing blanks. Implied by /F.
U[+/-] Convert to upper/lower case [+].
V[n,s] Reverse n [all] characters starting at position s.
W Wordstar document ==> ASCII textfile. Implies /P.
X[n,m] Extract m lines starting at line n.
Z[+] Remove NULLs. Z+: also ANSI screen control sequences.
txtopt: /A[+/-][p][*] text Include lines after specified text only.
/B[+/-][p][*] text Include lines before specified text only.
/G[+/-][p][*] text Include lines with the specified text only.
--- End quote ---
* FU - Text Filter Utility. A multi-purpose text line filter.
Version 3.56 (C) Copyright 1990 by David Lo. Jun/90
Usage
-----
FU :option parameters ...
where :options is one or more from the following list. Options
below are grouped by function. Parameters in square brackets are
optional. A brief description of the option is shown. Use FU -? or
FU with no parameters for a list of the options.
Select lines:
BEGSTR str [n] lines after a line with search string
COPY all lines
DEROFF [str] lines without .nroff commands
ENDSTR str [n] lines before a line with srch string
FIND str lines containing a string
FIND0 str lines not containing a string
LINES [first [last] lines in given line range
NULL0 non-blank lines
OUTSTR str1 str2 [n] lines outside str1 and str2
SURSTR str1 str2 [n] lines between str1 and str2
UNIQUE non-repeating lines in sorted file
Remap characters:
ASCII zero high-bit
DEBOX [box_str] remap box chars to printable chars
ENC [keyword] encrypt/decrypt
LOWER convert to lower case
TRANS old [new] translate one set of chars to another
UPPER convert to upper case
Change lines:
CHANGE old [new] change one string to another
DECTRL [HLD]* delete/change 0..31/128.255 to \nnn
NUM [n_digits [spaces]] number lines
PRINTF [n] convert \nnn to characters
PREFIX str add string before line
SUFFIX str add string after line
..... and much more
--- End quote ---
* LM version 2.06
The LM command inputs line by line from files or stdin, then
manipulate the line according to the command line options before
sending the final form to a file or stdout.
The main operations supported are grip/non-grip, search/replace,
synchronised line appendage from other files, input/output line
selection by line numbers or passwords, spaces/empty lines
absorption, filewise update or renaming, line width imposition and
etc. Command line options may be read in from a text file, and input
lines can also be taken from the command line aline.
AUTHOR: ¦
+---------+
Zhuhan JIANG, University of New England, Armidale NSW 2351, Australia
Line manipulator - ver 2.06 January 1997 by Zhuhan Jiang.
usage lm [-options] [string1] [string2 etc]
helps lm -h (simple help) lm -H (more help) lm -hH (manual)
priority -@ -<* -;* -hH -j# -v -V -X# -/# -{#[]}* -BE*(#) -zZ# -$*(j20-28&#)
-c# -:* -^*(+1) -fF*(+0**X7-11) -*`* -pP*(M#+2) -iI# -lL# -sS#
-dD*(C2n#) -g*(G#J1j9!#)[X5] -qr*(j1j2j6-8) -QR*(j3j4j6-8) -()*
-m*(C3kK*) -Y# -t# -T# -a -A* -~*(C1J2) -=#(X1) -y# -oO#(N#!#) -!#
-N# -be*(#) -w#(W#) -uU*(+3) -#? -#?(even no. such options) -.# -x#
*=str, #|?=no. (after a char), ()=related mode, []=forced option
shorthand //# via -f^uU< is #th file of LMFILES, -F//*[;|:]* parses path *
tmpfiles in TMPDIR or root directory
extendkey (dos) 0? for -$* under -j28 is denoted by 255? e.g. "-/255$;"=F1
--- End quote ---
* Minitrue Version 2.0.2
http://www.pagesz.net/~minitrue
Copyright (C) 1995-99 Andrew B. Pipkin
MiniTrue 2.0.2 (Alpha #3) for 16-bit DOS Dec 20 1999
Copyright (C) 1995-99 Andrew Pipkin
MiniTrue is free software released with no warranty. See COPYING for details.
Usage: mt [-options] [files] - [strings]
-a search All files -b make Backup files
-c Case insensitivity -d preserve original Datestamps
-e ignore file Errors -f Fold lines at word breaks
-h begin in Hex mode -i:FILE read strings from FILE
-k Keep statistics -l generate Log file
-mNUM set top Margin -n No prompting
-o use standard Output (grep mode) -p:SET define set of printing chars
-q Quiet mode -r Recurse through subdirectories
-s accelerated Scrolling -tTABSIZE set Tab size
-u set region for boolean searches -v set Video mode
-w Whole words only -x use regular eXpressions
-y skip binarY files -z unZip files before searching
-@:FILE read filenames from FILE
Default options: -c -x -z-:.zip:pkunzip:-c -p:[\x20-\x7e\xa0-\xff] -b:* -s6:10
Enter mt -? to view the help file, mt -?:<option> for option information
--- End quote ---
want to know about more tools too.
-----
couldn'd this posting input window be bigger sized ???
e.g. expanded to the left and double in high.
mouser:
cool links, thanks stefan :)
Navigation
[0] Message Index
[#] Next page
Go to full version