10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hello.
I try to merge few /etc/qconfig files in AIX (from few servers into one file on new server).
Could you please help me what would be the best way to merge files that contain multi-line stanzas, like this:
stanza1:
attr1 = value1
attr2 = value2
attr3 = value3
stanza2:
attr1 =... (7 Replies)
Discussion started by: kareem33
7 Replies
2. UNIX for Dummies Questions & Answers
Hello,
i want to merge two files via terminal. After three lines of file one i will append a line of file two:
Example:
File 1:
@chr1_15953153_15953093_1_0_0_0_1:0:0_0:0:0_0/1
TGTCGTAAAATCACAACGTCCCCATCTTTCAAGCCATAAGCAGCCAATGATCTGTGGTTGTCTGTGAGAGGTCTTTCCGCATAGACGATCTACAACAAGA
+... (3 Replies)
Discussion started by: Innsbrucker
3 Replies
3. Shell Programming and Scripting
example:
comment Now_TB.table column errac is for error messages
1 - first
2 - second
3 -third ;
in this example I need to be able to grab the comment as first word and ; as the last word and it might span a few lines. I need it to be put all in one line without line breaks so I can... (4 Replies)
Discussion started by: wambli
4 Replies
4. Shell Programming and Scripting
Hi All,
I have two files having oracle query result. I want to merge to files line by line and also with column
File1
23577|SYNC TYPE
23578|Order Number|ConnectionState
23585|Service State|Service NameFile2
23577|AR Alarm Sync
23578|A5499|9
23585|7|test_nov7Result... (18 Replies)
Discussion started by: Harshal22
18 Replies
5. Shell Programming and Scripting
Hi Gurus,
I have n number of files. Data which is in the files have column headers. I need to take them out and merge into one file.
Can you help please?
I need to do that little urgent.
Thanks (4 Replies)
Discussion started by: raopatwari
4 Replies
6. Shell Programming and Scripting
Hello
I did do a search and the past threads doesn't really solve my issue. (using various awk commands)
I need to combine the output from java -version into 1 line, but I am having difficulties.
When you exec java -version, you get:
java version "1.5.0_06"
Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies
7. UNIX for Dummies Questions & Answers
Hello everybody,
I'm trying to merge a lot of files, but I want to include the filename to the end of each line. I've tried to use cat, but I got stuck.
My files are for example:
file01.001
123456 aaa ddd ee
458741 eee fff ee
file02.003
478596 uuu ddd ee
145269 ttt fff ee
... (4 Replies)
Discussion started by: ernesto561
4 Replies
8. Shell Programming and Scripting
Hi,
lets assume the following details..
file 1 has below details
abc|1234|xyz
abc1|1234|xyz1
abc2|1234|xyz2
and file 2 has below details
pqr|124|lskd
ebwer|325|dfb
wf|234|sdb
I need out put shown below
abc|1234|xyz
pqr|124|lskd
abc1|1234|xyz1
ebwer|325|dfb
abc2|1234|xyz2... (4 Replies)
Discussion started by: alnhk
4 Replies
9. Shell Programming and Scripting
Hi,
Can anyone know how to use perl to merge the following multi-line information which beginning with "BAM" into one line. For each line need to delete the return and add a space. Please see the red color line.
******Org. Multi-line)
BAM admin 101.203.57.22 ... (3 Replies)
Discussion started by: happyday
3 Replies
10. Shell Programming and Scripting
I have 3 file, each of has got 80000 records.
file1.txt
-----------------------
ABC001;active;modify;accept;
ABC002;notactive;modify;accept;
ABC003;notactive;no-modify;accept;
ABC004;active;modify;accept;
ABC005;active;no-modify;accept;
file2.txt
---------------------------... (8 Replies)
Discussion started by: ganesh_mak
8 Replies
fold(1) General Commands Manual fold(1)
NAME
fold - Breaks or wraps lines in a file
SYNOPSIS
fold [-bs] [-w width | -width] [file...]
The fold command wraps lines in the specified files. If a file is not specified, standard input is the default. All lines are wrapped to
meet the maximum width specified.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
fold: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Specifies that width be counted in bytes rather than in column positions. Using the -b option does not limit lines to LINE_MAX bytes.
Breaks (or wraps) a line if a segment of the line contains a blank character in the first width column position (or bytes). This enables
the line to meet width constraints. If a blank character is not in the correct width column position, the -s option has no affect on that
input line. Specifies the maximum width to use when lines are wrapped in column positions (or bytes if the -b option is specified).
Either -w width or -width is acceptable input where width is the number of column positions (or bytes). The default value is 80.
DESCRIPTION
The fold command is a filter that wraps lines from the specified input files or standard input to a maximum of width (or bytes, if the -b
option is specified). The fold command wraps lines by inserting a newline character into the output so that each output line is the maxi-
mum column positions or bytes specified. A line cannot be broken in the middle of a character.
The fold command is often used to send text files to line printers that truncate, rather than wrap, lines wider than the printer is able to
print (usually 80 or 132 column positions).
If the <backspace>, <tab>, or <carriage return> characters are encountered in the input, and the -b option is not specified, these charac-
ters are treated specially: The current count of line width is decremented by one, although the count never becomes negative. The fold
command does not insert a newline character immediately before or after any backspace character. Each tab character encountered advances
the column position pointer to the position of the next tab stop. Tab stops are at each column position number, such that number modulo 8
equals 1. The current count of the line width is set to zero (0). The fold command does not insert a newline immediately before or after
any carriage return.
[Tru64 UNIX] The fold command possibly affects underlining in a file.
EXIT STATUS
The fold command returns the following values: All input files were successfully processed. [Tru64 UNIX] A usage error occurred. [Tru64
UNIX] An input file cannot be opened. The fold command continues processing the other input files specified on the command line.
EXAMPLES
The fold command can be used to prepare files to be joined side-by-side with the paste command. For example, the contents of two files, az
and AZ follows:
aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz
AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ
To display the az and AZ files side-by-side, use the following command line: fold -w 32 az > az2; fold -w 32 AZ > AZ2; paste -d" " az2 AZ2
Executing the previous command line results in the following output:
aaaa bbbb cccc dddd eeee ffff gg AAAA BBBB CCCC DDDD EEEE FFFF GG gg hhhh iiii jjjj kkkk llll mmmm GG HHHH IIII JJJJ KKKK LLLL MMMM nnnn
oooo pppp qqqq rrrr ssss tt NNNN OOOO PPPP QQQQ RRRR SSSS TT tt uuuu vvvv wwww xxxx yyyy zzzz TT UUUU VVVV WWWW XXXX YYYY ZZZZ
ENVIRONMENT VARIABLES
The following environment variables affect the execution of fold: Provides a default value for the internationalization variables that are
unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari-
ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value,
overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as opposed to multibyte characters in arguments) and for the determination of the
width in column positions each character would occupy on a constant-width font output device. Determines the locale for the format and
contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MES-
SAGES.
SEE ALSO
Commands: cut(1), expand(1), paste(1)
Standards: standards(5)
fold(1)