06-05-2009
Insert file names when concatenate files into a file
Hi
I found the following line would concatenate all test_01 test_02 test_03 files into "bigfile".
cat test_* >> bigfile
But, what I'm looking for a way to insert each file names in order when concatenated in "bigfile".
Thank you
samky2005
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
i have below files in wrk folder. file names are
1102090001.CLT
1102090003.CLT
1102100019.CLT
1102100020.CLT
the above files are concatenate to one file but that concatenate file name must be same naming convention. (date +%y%m%d)and 0001 count.
example : concatenate file... (9 Replies)
Discussion started by: krbala1985
9 Replies
2. Shell Programming and Scripting
Hi,
I have a data file xyz.dat similar to the one given below,
2345|98|809||x|969|0
2345|98|809||y|0|537
2345|97|809||x|544|0
2345|97|809||y|0|651
9685|98|809||x|321|0
9685|98|809||y|0|357
9685|98|709||x|687|0
9685|98|709||y|0|234
2315|98|809||x|564|0
2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies
3. Shell Programming and Scripting
I have a couple of text files
which are named as
1.txt
2.txt
1000.txt
11.txt
I want to cat/merge the contents of each text file into one single file like this
1
content of 1.txt
2
content of 2.txt
1000
content of 1000.txt
11
content of 11.txt (2 Replies)
Discussion started by: Lucky Ali
2 Replies
4. Shell Programming and Scripting
Gents,
I have lot of files in a folder where each file name includes the date of generation, then I would like to merge
all the files for each date in a complete file.
list of files in forder.
dsd01_121104.txt
dsd01_121105.txt
dsd01_121106.txt
dsd03_121104.txt
dsd03_121105.txt... (7 Replies)
Discussion started by: jiam912
7 Replies
5. UNIX for Dummies Questions & Answers
hi,
I need a help. I used this command to list all the log files which are for more than 10 days to a text file.
find /usr/script_test -type f -mtime +10>>/usr/ftprm.txt
I want all these files listed in the ftprm.txt to be ftp in another machine and then rm the files.
Anyone can help me... (8 Replies)
Discussion started by: kamaldev
8 Replies
6. Shell Programming and Scripting
Hi Experts,
I am trying to merge multiple files into one file based upon the file name.
Testreport_Server1.txt ============
MonitoringReport_Server1.txt============ CentralReport_Server1
Here two files containing server1 should be merged into one file?
How can i do... (16 Replies)
Discussion started by: sharsour
16 Replies
7. Shell Programming and Scripting
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
Discussion started by: dsravanam
1 Replies
8. Shell Programming and Scripting
Hi, I have a control file which will contain all filenames(300) files. Loop through all the file names in the control files and check the existence of this file in another directory(same server). I need to infinitely(2 hrs) run this while loop until all the files are found. Once a file is found,... (5 Replies)
Discussion started by: laknar
5 Replies
9. Shell Programming and Scripting
Hi,
I need some help in the below scenario.
I need to delete all the files from the directory except the file name available in the Except file.
Like the folder ABC have files like A1.txt,A2.txt......A10.txt
and also have a file named Except.txt with the content A3.txt,A4.txt
Need a... (6 Replies)
Discussion started by: kban
6 Replies
10. Shell Programming and Scripting
Dear all,
I have a list of files and I woulk like to concatenate some of them based on their name.
Basically my files are names like that:
file1_abcd_other_useless_letters_1_C1.txt
file1_abcd_other_useless_letters_1_C2.txt
file1_xywz_other_useless_letters_1_C1.txt... (4 Replies)
Discussion started by: giuliangiuseppe
4 Replies
fold(1) User Commands fold(1)
NAME
fold - filter for folding lines
SYNOPSIS
fold [-bs] [-w width | -width] [file...]
DESCRIPTION
The fold utility is a filter that will fold lines from its input files, breaking the lines to have a maximum of width column positions (or
bytes, if the -b option is specified). Lines will be broken by the insertion of a NEWLINE character such that each output line (referred to
later in this section as a segment) is the maximum width possible that does not exceed the specified number of column positions (or bytes).
A line will not be broken in the middle of a character. The behavior is undefined if width is less than the number of columns any single
character in the input would occupy.
If the CARRIAGE-RETURN, BACKSPACE, or TAB characters are encountered in the input, and the -b option is not specified, they will be treated
specially:
BACKSPACE The current count of line width will be decremented by one, although the count never will become negative. fold
will not insert a NEWLINE character immediately before or after any BACKSPACE character.
CARRIAGE-RETURN The current count of line width will be set to 0. fold will not insert a NEWLINE character immediately before or
after any CARRIAGE-RETURN character.
TAB Each TAB character encountered will advance the column position pointer to the next tab stop. Tab stops will be at
each column position n such that n modulo 8 equals 1.
OPTIONS
The following options are supported:
-b Counts width in bytes rather than column positions.
-s If a segment of a line contains a blank character within the first width column positions (or bytes), breaks the line after
the last such blank character meeting the width constraints. If there is no blank character meeting the requirements, the
-s option will have no effect for that output segment of the input line.
-w width|-width Specifies the maximum line length, in column positions (or bytes if -b is specified). If width is not a positive decimal
number, an error is returned. The default value is 80.
OPERANDS
The following operand is supported:
file A path name of a text file to be folded. If no file operands are specified, the standard input will be used.
EXAMPLES
Example 1: Submitting a file of possibly long lines to the line printer
An example invocation that submits a file of possibly long lines to the line printer (under the assumption that the user knows the line
width of the printer to be assigned by lp(1)):
example% fold -w 132 bigfile | lp
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of fold: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 All input files were processed successfully.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
cut(1), pr(1), attributes(5), environ(5), standards(5)
NOTES
fold and cut(1) can be used to create text files out of files with arbitrary line lengths. fold should be used when the contents of long
lines need to be kept contiguous. cut should be used when the number of lines (or records) needs to remain constant.
fold is frequently used to send text files to line printers that truncate, rather than fold, lines wider than the printer is able to print
(usually 80 or 132 column positions).
fold may not work correctly if underlining is present.
SunOS 5.10 1 Feb 1995 fold(1)