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 OPENSOLARIS
col
col(1) User Commands col(1)NAME
col - reverse line-feeds filter
SYNOPSIS
col [-bfpx]
DESCRIPTION
The col utility reads from the standard input and writes to the standard output. It performs the line overlays implied by reverse line-
feeds, and by forward and reverse half-line-feeds. Unless -x is used, all blank characters in the input will be converted to tab characters
wherever possible. col is particularly useful for filtering multi-column output made with the .rt command of nroff(1) and output resulting
from use of the tbl(1) preprocessor.
The ASCII control characters SO and SI are assumed by col to start and end text in an alternative character set. The character set to which
each input character belongs is remembered, and on output SI and SO characters are generated as appropriate to ensure that each character
is written in the correct character set.
On input, the only control characters accepted are space, backspace, tab, carriage-return and newline characters, SI, SO, VT, reverse line-
feed, forward half-line-feed and reverse half-line-feed. The VT character is an alternative form of full reverse line-feed, included for
compatibility with some earlier programs of this type. The only other characters to be copied to the output are those that are printable.
The ASCII codes for the control functions and line-motion sequences mentioned above are as given in the table below. ESC stands for the
ASCII escape character, with the octal code 033; ESC- means a sequence of two characters, ESC followed by the character x.
reverse line-feed ESC-7
reverse half-line-feed ESC-8
forward half-line-feed ESC-9
vertical-tab (VT) 013
start-of-text (SO) 016
end-of-text (SI) 017
OPTIONS -b Assume that the output device in use is not capable of backspacing. In this case, if two or more characters are to appear in the
same place, only the last one read will be output.
-f Although col accepts half-line motions in its input, it normally does not emit them on output. Instead, text that would appear
between lines is moved to the next lower full-line boundary. This treatment can be suppressed by the -f (fine) option; in this case,
the output from col may contain forward half-line-feeds (ESC-9), but will still never contain either kind of reverse line motion.
-p Normally, col will ignore any escape sequences unknown to it that are found in its input; the -p option may be used to cause col to
output these sequences as regular characters, subject to overprinting from reverse line motions. The use of this option is highly
discouraged unless the user is fully aware of the textual position of the escape sequences.
-x Prevent col from converting blank characters to tab characters on output wherever possible. Tab stops are considered to be at each
column position n such that n modulo 8 equals 1.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of col: LC_CTYPE, LC_MESSAGES, and
NLSPATH.
EXIT STATUS
The following error values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
|CSI |enabled |
+-----------------------------+-----------------------------+
SEE ALSO nroff(1), tbl(1), ascii(5), attributes(5), environ(5)NOTES
The input format accepted by col matches the output produced by nroff with either the -T37 or -Tlp options. Use -T37 (and the -f option of
col) if the ultimate disposition of the output of col will be a device that can interpret half-line motions, and -Tlp otherwise.
col cannot back up more than 128 lines or handle more than 800 characters per line.
Local vertical motions that would result in backing up over the first line of the document are ignored. As a result, the first line must
not have any superscripts.
SunOS 5.11 1 Feb 1995 col(1)