08-23-2014
Your desired output is a little ambiguous. Are the filenames included as text on the first line in the files?
Is the number to be replaced in the files a constant, or should it be extracted from the name of the file being processed.
Your for loop is only looking for files starting with f1, but it looks like you want to process all files starting with f and ending with .txt or maybe starting with f followed by one (or one or more) digits followed by an underscore and any string of 8 digits (or a particular string of 8 digits) followed by and ending with .txt. Please describe in English which set of files should be processed.
If more than one date's input files are to be processed as a set and the output files are supposed to have a single output date, are the numbers between the f and the _ in the output filenames supposed to be adjusted? If so, does the output order matter? Will there ever be more than 9 input or output files for a given date?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a problem in the following code ...
while read line
do
#Get Line Number
OLDLINE=`sed -n $Lineno $filename`
echo "Un Changed Line : "$OLDLINE
echo "Enter a New Pattern : "
read NewPattern <&1
echo "NewPattern :"$NewPattern
NEWLINE=`cat $filename | sed -n... (1 Reply)
Discussion started by: maxmave
1 Replies
2. Shell Programming and Scripting
Hi Everyone,
cat 1.txt
aaa
bbb
ccc
outout will be
cat 2.txt
,,aaa,,bbb,ccc,,
means change "\n" to ",,", and add ",," into the beginging and ending.
right now i am using perl while to open and read the file, then split \t, feel not nice. please advice.
and i hear using perl... (8 Replies)
Discussion started by: jimmy_y
8 Replies
3. Shell Programming and Scripting
Hi All,
As mentioned in the title I have two text files and I would like to replace line number 5 of file #1 with line number 4 of file #2
e.g.
file 1
wqwert
4.4464002
3
319
286
369
46.320002
56.150002
45.100002
1
1
1
0.723 (12 Replies)
Discussion started by: f_o_555
12 Replies
4. Shell Programming and Scripting
I have a file which has a list in it
pop
triangle
people
slow
fast
What I want to do is search this list and replace people with humans do the list looks like this:
pop
triangle
human
slow
fast
I think i use something like this....
if cat /list.txt | grep -q 'people' ; then (9 Replies)
Discussion started by: digitalviking
9 Replies
5. Shell Programming and Scripting
Hi all,
I need to replace a line
export TZ=xxxxxxxx
with the line
export TZ=$1
Now, "xxxxxxxx" in the above line is some unknown string and $1 is a parameter. I want the content of $1 to be replaced with "xxxxxxxx".
Kindly help me how to do this in the shell scripting. (5 Replies)
Discussion started by: ddeeps2610
5 Replies
6. Shell Programming and Scripting
Hello all,
I have data like
"1"|"My_name"|"My_Email"|"My_Last"|My_other"
"2"|"My_name"|"My_Email"|"My_Last"|My_other"
"3"|"My_name"|"My_Email"|"
"|My_other"
"1"|"My_name"|"My_Email"|"My_Last"|My_other"
Need output like
"1"|"My_name"|"My_Email"|"My_Last"|My_other"... (10 Replies)
Discussion started by: lokaish23
10 Replies
7. Shell Programming and Scripting
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies
8. Shell Programming and Scripting
Hi forum,
Can you please help me understand how to look for and replace the below pattern (containing line breaks) and return a new result?
Rules: Must match the 3 line pattern and return a 1 line result.
I have found solutions with sed, but it seems that sed installed in my system is... (5 Replies)
Discussion started by: demmel
5 Replies
9. UNIX for Dummies Questions & Answers
As per requirement if column 2 is NULL then 'N' ELSE 'Y'.
I have written below awk code. But it is not replacing values for first line. :confused:
cat temp.txt
1|abc|3
1||4
1|11|c
awk -F'|' '{if($2==""){$2="N"}else{$2="Y"} print $0 } {OFS="|"} ' < temp.txt
1 Y 3 ... (4 Replies)
Discussion started by: max_hammer
4 Replies
10. Shell Programming and Scripting
Hello is it possible with awk or sed to replace any white space with the previous line characters in the same position?
I am asking this because the file I have doesn't always follow a pattern.
For example the file I have is the result of a command to obtain windows ACLs:
icacls C:\ /t... (5 Replies)
Discussion started by: nakaedu
5 Replies
LEARN ABOUT DEBIAN
halibut
halibut(1) Simon Tatham halibut(1)
NAME
halibut - multi-format documentation formatting tool
SYNOPSIS
halibut [options] file1.but [file2.but ...]
DESCRIPTION
halibut reads the given set of input files, assembles them into a document, and outputs that document in one or more formats.
The available command-line options can configure what formats Halibut should output in, and can also configure other things about the way
Halibut works.
OPTIONS
The command-line options supported by halibut are:
--text[=filename]
Makes Halibut generate an output file in plain text format. If the optional filename parameter is supplied, the output text file
will be given that name. Otherwise, the name of the output text file will be as specified in the input files, or output.txt if none
is specified at all.
--html[=filename]
Makes Halibut generate one or more output files in HTML format. If the optional filename parameter is supplied, there will be pre-
cisely one HTML output file with that name, containing the whole document. Otherwise, there may be one or more than one HTML file
produced as output; this, and the file names, will be as specified in the input files, or given a set of default names starting with
Contents.html if none is specified at all.
--winhelp[=filename]
Makes Halibut generate an output file in Windows Help format. If the optional filename parameter is supplied, the output help file
will be given that name. Otherwise, the name of the output help file will be as specified in the input files, or output.hlp if none
is specified at all.
The output help file must have a name ending in .hlp; if it does not, .hlp will be added. A secondary contents file will be created
alongside the main help file, with the same name except that it will end in .cnt (for example output.cnt, if the main file is out-
put.hlp).
--man[=filename]
Makes Halibut generate an output file in Unix man page format. If the optional filename parameter is supplied, the output man page
will be given that name. Otherwise, the name of the output man page will be as specified in the input files, or output.1 if none is
specified at all.
--info[=filename]
Makes Halibut generate an info file. If the optional filename parameter is supplied, the output info file will be given that name.
Otherwise, the name of the output info file will be as specified in the input files, or output.info if none is specified at all.
By default, unless configured otherwise using the cfg{info-max-file-size}{0} directive, the info output will be split into multiple
files. The main file will have the name you specify; the subsidiary files will have suffixes -1, -2 etc.
--pdf[=filename]
Makes Halibut generate an output file in PDF format. If the optional filename parameter is supplied, the PDF output file will be
given that name. Otherwise, the name of the output PDF file will be as specified in the input files, or output.pdf if none is speci-
fied at all.
--ps[=filename]
Makes Halibut generate an output file in PostScript format. If the optional filename parameter is supplied, the PostScript output
file will be given that name. Otherwise, the name of the output PostScript file will be as specified in the input files, or out-
put.ps if none is specified at all.
-Cword:word[:word...]
Adds a configuration directive to the input processed by Halibut. Using this directive is exactly equivalent to appending an extra
input file to the command line which contains the directive cfg{word}{word}{word...}.
--input-charset=charset
Changes the assumed character set for input files from the default of ASCII.
--list-charsets
Makes Halibut list character sets known to it.
--list-fonts
Makes Halibut list fonts known to it, either intrinsically or by being passed as input files.
--precise
Makes Halibut report the column number as well as the line number when it encounters an error in an input file.
--help Makes Halibut display a brief summary of its command-line options.
--version
Makes Halibut report its version number.
--licence
Makes Halibut display its licence (MIT).
MORE INFORMATION
For more information on Halibut, including full details of the input file format, look in the full manual. If this is not installed locally
on your system, you can also find it at the Halibut web site:
http://www.chiark.greenend.org.uk/~sgtatham/halibut/
BUGS
This man page isn't terribly complete.
Halibut 2004-04-08 halibut(1)