10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to add a line to the end of a single column text file. How do I go about doing that?
Input:
BEGIN
1
2
3
Output:
BEGIN
1
2
3
END
Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies
2. Shell Programming and Scripting
Hi All,
Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example :
abc.txt
7000,john,2,1,0,1,6
7001,elen,2,2,0,1,7
7002,sami,2,3,0,1,6
7003,mike,1,4,0,2,1
8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies
3. Shell Programming and Scripting
Hi,
I have a requirement with,
No~Dt~Notes
1~2011/08/1~"aaa
bbb
ccc
ddd
eee
fff
ggg
hhh"
Single column alone got splitted into multiple lines.
I require the output as
No~Dt~Notes
1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh"
mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies
4. UNIX for Dummies Questions & Answers
Hello everyone!
As the heading reads, I would like to sort the lines of a text file, starting at a specific column (i.e. skip the first X characters of each line).
What I’m actually trying to sort is the md5 sums file of a directory. Every time I copy a new file to that directory, I perform... (3 Replies)
Discussion started by: iznogoud
3 Replies
5. Shell Programming and Scripting
Hi all,
I have an input file like
1,date,company,,
1,date,comapny,,
2,000,,,567,ACT,00,,,,KKG,M1,D45,,67J,+4500000000
2,000,,,567,ACT,00,,,,KKG,M6,D49,,56J,+6000
2,000,,,567,ACT,00,,7,,KKG,M3,D58,,68h,-70000
2,000,,,567,ACT,00,,,,KKG,M9,D95,,34m,0.00
3,total
what i require is
1.I... (2 Replies)
Discussion started by: selvankj
2 Replies
6. Shell Programming and Scripting
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies
7. Shell Programming and Scripting
Can any one tell me how to get the second last column value from the text file, which has different record size for each record.
I know how to get the last column using awk and print statements, but I am unable to get the second last column value from the file. (4 Replies)
Discussion started by: naveen_sangam
4 Replies
8. Shell Programming and Scripting
Hi,
I need to find out the last column value from a text file which is delimited by a tab.
The issue here is the last column# for each record can be different i.,e, 1st record can have the last column as 15 and the second record can have the last column as "17".
I have to search a string... (3 Replies)
Discussion started by: naveen_sangam
3 Replies
9. Shell Programming and Scripting
What would be the most succinct way of doing this (preferably in 1 line, maybe 2):
searching the first 10 characters of every line in a text file for a specific string, and if it was found, print out characters 11-20 of the line on which the string was found.
In this case, it's known that there... (13 Replies)
Discussion started by: busdude
13 Replies
10. Shell Programming and Scripting
Hi,
I need a script to get every line from a file where there are less then
17 ; on a line.
Thank's (5 Replies)
Discussion started by: VODAFUN
5 Replies
fold(1) General Commands Manual fold(1)
NAME
fold - fold long lines for finite width output device
SYNOPSIS
width] [file ...]
Obsolete form:
width] [file ...]
DESCRIPTION
The command is a filter that folds the contents of the specified files, breaking the lines to have a maximum of width column positions (or
bytes, if the option is specified). The command breaks lines by inserting a newline character so that each output line is the maximum
width possible that does not exceed the specified number of column positions (or bytes). A line cannot be broken in the middle of a char-
acter. If no files are specified or if a file name of is specified, the standard input is used.
The command is often used to send text files to line printers that truncate, rather than fold, lines wider than the printer is able to
print.
If the backspace, tab, or carriage-return characters are encountered in the input, and the option is not specified, they are treated spe-
cially as follows:
Backspace The current count of line width is decremented by one, although the count never becomes negative. Thus, the char-
acter sequence character-backspace-character counts as using one column position, assuming both characters each
occupy a single column position. does not insert a newline character immediately before or after any backspace
character.
Tab Each tab character encountered advances the column position pointer to the next tab stop. Tab stops are set 8 col-
umns apart at column positions 1, 9, 17, 25, 33, etc.
Carriage-return The current count of line width is set to zero. does not insert a newline character immediately before or after
any carriage-return character.
Note that may affect any underlining that is present.
Options
The command recognizes the following options and command-line arguments:
Count width in bytes rather than in column positions.
Break the line on the last blank character found
before the specified number of column positions (or bytes). If none are found, break the line at the specified
line length.
Specify the maximum line length, in column positions (or bytes if
is specified). The default value is 80. width should be a multiple of 8 if tabs are present, or the tabs should
be expanded using before processing by (see expand(1)). The option is obsolescent and may be removed in a future
release.
EXTERNAL INFLUENCES
Environment Variables
determines the interpretation of text as single- and/or multi-byte characters.
determines the language in which messages are displayed.
If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty
variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of
If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
SEE ALSO
expand(1).
STANDARDS CONFORMANCE
fold(1)