I was also trying the solution for the above one.. even though i was trying your solution, i was not getting the result. can you tell me where i am going wrong.
Dear friends,
In VI, I have these data shown below:
Line1
Line2
Line3
Line4
How can I JOIN these line to the first line? When I finished I should have:
Line1 Line2 Line3 Line4
is there a text length limit of how long a single line can be in VI?
Thank you much! (10 Replies)
Break one line to many lines using awk
The below code works but i want to implement without combining field 2 and 3 and then splitting i would like to do this in one command
instead of writing multiple commands and creating multiple lines.
nawk -F"|" '{print $1,$2SUBSEP$3}' OFS="|" file >... (16 Replies)
i had a file where lines appear to be broken when they shouldn't
eg
Line 1. kerl abc sdskd sdsjkdlsd sdsdksd \
Line 2. ksdkks sdnjs djsdjsd
i can do a shift join to combine the lines but i there are plenty of files with this issue
Line 1. kerl abc sdskd sdsjkdlsd sdsdksd ksdkks sdnjs... (6 Replies)
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)
HI,
My input file contains the data as like below:
A1234119993
B6271113
Bghjkjk
A1234119992
B6271113hi
Bghjkjkmkl
the output i require is :
A1234119993 B6271113 Bghjkjk
A1234119992 B6271113hi Bghjkjkmkl
Please help me in this.
Thanks (6 Replies)
Hi
I have a file with below content :
a
b
S
I need to replace the lines which have a and b continuously by d.
d
S
I have used the below code
tr '\n' '#'<file|sed. 's/a#b/d/g's?|tr '#' '\n' where # is not occurring anywhere in the file..
Is there any other efficient way to do this?
... (7 Replies)
Hi,
I need some iteration to do the following work.
Sample:
ANS|26-Jan-2012|26|MON|12536.1
ANS|26-Jan-2012|26|TUE|2536.1
ANS|26-Jan-2012|26|THUR|789.1
SED|26-Jan-2013|32|MON|258.1
SED|26-Jan-2013|32|TUE|369.1
SED|26-Jan-2013|32|THUR|2145.1
OUTPUT:
... (3 Replies)
Hi,
I have the following data:
This this DT 0.99955 0 4
is be VBZ 1 5 7
sentence sentence NN 0.916667 8 16
one one NN 0.545078 17 20
. . Fp 1 20 21
This this DT 0.99955 22 26
is be VBZ 1 27 29
the the DT 1 30 33
second 2 JJ 0.930556 34 40
sentence sentence NN 0.916667 41 49... (1 Reply)
I need to break the line after every 3rd semi colon(;) using Unix shell scripting
Input.txt
ABC;DEF;JHY;LKU;QWE;BVF;RGHY;
Output.txt
ABC;DEF;JHY;
LKU;QWE;BVF;
RGHY; (1 Reply)
Discussion started by: meet_calramz
1 Replies
LEARN ABOUT OPENDARWIN
fmt
FMT(1) BSD General Commands Manual FMT(1)NAME
fmt -- simple text formatter
SYNOPSIS
fmt [-cmnps] [-d chars] [-l num] [-t num] [goal [maximum] | -width | -w width] [file ...]
DESCRIPTION
The fmt utility is a simple text formatter which reads the concatenation of input files (or standard input if none are given) and produces on
standard output a version of its input with lines as close to the goal length as possible without exceeding the maximum. The goal length
defaults to 65 and the maximum to 10 more than the goal length. Alternatively, a single width parameter can be specified either by prepend-
ing a hyphen to it or by using -w. For example, ``fmt -w 72'', ``fmt -72'', and ``fmt 72 72'' all produce identical output. The spacing at
the beginning of the input lines is preserved in the output, as are blank lines and interword spacing. Lines are joined or split only at
white space; that is, words are never joined or hyphenated.
The options are as follows:
-c Center the text, line by line. In this case, most of the other options are ignored; no splitting or joining of lines is done.
-m Try to format mail header lines contained in the input sensibly.
-n Format lines beginning with a '.' (dot) character. Normally, fmt does not fill these lines, for compatibility with nroff(1).
-p Allow indented paragraphs. Without the -p flag, any change in the amount of whitespace at the start of a line results in a new para-
graph being begun.
-s Collapse whitespace inside lines, so that multiple whitespace characters are turned into a single space. (Or, at the end of a sen-
tence, a double space.)
-d chars
Treat the chars (and no others) as sentence-ending characters. By default the sentence-ending characters are full stop ('.'), ques-
tion mark ('?') and exclamation mark ('!'). Remember that some characters may need to be escaped to protect them from your shell.
-l number
Replace multiple spaces with tabs at the start of each output line, if possible. Each number spaces will be replaced with one tab.
The default is 8. If number is 0, spaces are preserved.
-t number
Assume that the input files' tabs assume number spaces per tab stop. The default is 8.
The fmt utility is meant to format mail messages prior to sending, but may also be useful for other simple tasks. For instance, within vis-
ual mode of the ex(1) editor (e.g., vi(1)) the command
!}fmt
will reformat a paragraph, evening the lines.
SEE ALSO mail(1), nroff(1)HISTORY
The fmt command appeared in 3BSD.
The version described herein is a complete rewrite and appeared in FreeBSD 4.4.
AUTHORS
Kurt Shoens
Liz Allen (added goal length concept)
Gareth McCaughan
BUGS
The program was designed to be simple and fast - for more complex operations, the standard text processors are likely to be more appropriate.
When the first line of an indented paragraph is very long (more than about twice the goal length), the indentation in the output can be
wrong.
The fmt utility is not infallible in guessing what lines are mail headers and what lines are not.
BSD June 25, 2000 BSD