Get the 1st 99 characters and add new line feed at the end of the line
I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed).
I'm using this line of code to achieve this.
However, we are having problems when the length of a record within the file exceeds 100 characters. The receiving program that processes my output file is unable to parse it correctly.
I was asked to truncate the records first, get the first 99-characters of each line, and then add the line feed character at the end of the line.
Hi i would like to add line numbers to end of each line in a file.
I am able to do it in the front of each line using sed, but not able to add at the end of the file.
Can anyone suggest
The following code adds line number to start of each line
sed = filename | sed 'N;s/\n/\t/'
how can i... (5 Replies)
Hi
I have a file with lots of line feeds and form feeds (page break). Need to replace last occurrence of form feed (created by - echo "\f" ) in the file with line feed.
Please advise how can i achieve this.
TIA
Prvn (5 Replies)
Hi All,
I have a xml file and requirement is to remove the line feed and add line feed after some element.
<?xml version="1.0" ?>
<AUDITRECORDS>
<CARF>
<HED>
<VN1>20090616010622</VN1>
<VN2>0</VN2>
<VN3>1090</VN3>
<VN4>CONFIG_DATA</VN4>
... (8 Replies)
Hi all,
using VI, can anyone tell me how to add some characters onto the end of a line where the line begins with certain charactars eg
a,b,c,.......,
r,s,t,........,
a,b,c,.......,
all lines in the above example starting with a,b,c, I want to add an x at the end of the line so the... (6 Replies)
How can I specify special meaning characters like ^ or $ inside a regex range. e.g
Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character.
I tried the following but it does not work:
sed 's/\(\)/<do something here>/g' file1
... (3 Replies)
Hi! I have been struggling with a large file that has stray end of line characters.
I am working on a Mac (Lion). I mention this only because I have been mucking around with fixing my problem using sed, and I have learned far more than I wanted to know about Unix and Mac eol characters.
I... (1 Reply)
Hello,
I'm looking for some help in renaming data-timestamps stored within different calendar directories/files.
The calendar directory has hundreds of ICS files:
~/Library/Calendars/F494C908.calendar/Events/92B65E439AAC.ics
~/Library/Calendars/F494C908.calendar/Events/DE7867E61969.ics... (8 Replies)
Hello,
Can someone please share a Simple AWK command to append Carriage Return & Line Feed to the end of the file, If the Carriage Return & Line Feed does not exist !
Thanks (16 Replies)
Discussion started by: rosebud123
16 Replies
LEARN ABOUT ULTRIX
ptx
ptx(1) General Commands Manual ptx(1)Name
ptx - create permuted index
Syntax
ptx [option...] [input[output]]
Description
The command generates a permuted index to file input on file output (standard input and output default). It has three phases: the first
does the permutation, generating one line for each keyword in an input line. The keyword is rotated to the front. The permuted file is
then sorted. Finally, the sorted lines are rotated so the keyword comes at the middle of the page. The command produces output in the
form:
.xx "tail" "before keyword" "keyword and after" "head"
where .xx may be an or macro for user-defined formatting. The before keyword and keyword and after fields incorporate as much of the line
as fits around the keyword when it is printed at the middle of the page. The and commands, at least one of which is an empty string "",
are wrapped-around pieces small enough to fit in the unused space at the opposite end of the line. When original text must be discarded,
`/' marks the spot.
Options
The following options can be applied:
-b break Use the characters in the break file as separators. In any case, tab, new line, and space characters are always used
as break characters.
-f Folds upper and lower case letters for sorting.
-g n Uses specified number as interfield gap. The default gap is 3 characters.
-i ignore Do not use as keywords any words given in the ignore file. If the -i and -o options are missing, use /usr/lib/eign as
the ignore file.
-o only Use words listed only in the only file.
-r Uses leading nonblanks as reference identifiers. Attach that identifier as a 5th field on each output line.
-t Prepares the output for the phototypesetter. The default line length is 100 characters.
-w n Use the next argument, n, as the width of the output line. The default line length is 72 characters.
Restrictions
Line length counts do not account for overstriking or proportional spacing.
Files
/usr/bin/sort
/usr/lib/eign
ptx(1)