The previous post is only for GNU sed that is compiled with a recent glibc that has got the \S \s from perl (PCRE).
If you want portability, use the original! Most commercial Unixes have got perl.
This works, but in warning mode it says
Since perl 5.x it issues this warning. Fix: $n is like a variable that you can write ${n} (just like a variable in the shell).
Demo:
This User Gave Thanks to MadeInGermany For This Post:
Hi, Iam new to unix. I have one input file .
Input file :
ID1~Name1~Place1
ID2~Name2~Place2
ID3~Name3~Place3
I need output such that only first column should change to fixed width column of 15 characters of length.
Output File:
ID1<<12 spaces>>Name1~Place1
ID2<<12... (5 Replies)
Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2
file 1 sample
SNDK 80004C101 AT
XLNX 983919101 BB
NETL 64118B100 BS
AMD 007903107 CC
KLAC 482480100 DC
TER 880770102 KATS
ATHR 04743P108 KATS... (7 Replies)
Hi everyone, and thanks after all
I'm a biologist and i have to extract information from one text. The text is something like this
1023 A A 56 0 cc...,,,,..gg..Cc.c,,c..CC..,,
1024 T T 86 0 ..,,,..aaAA..,,aAA,,a,,A,,a
1025 G G 125 0 ... (5 Replies)
Hi
I wanted to fetch particular characters from a column.I have a file having columns separated by pipe operator.
The contents of the file are Task | Task started on a component | B678C56D-96DA-4FFC-B40E-9A032A2EB12E-0000004 | service.adapter:UCF Version Creator
... (2 Replies)
Hello all,
I have a data like this:
X:04252 X:05524 X:04176
X:05509 X:05524 X:04674-
X:1662912 X:10181
X:16491 X:05506
X:05216- X:05488
X:46872 X:08471
X:04834 X:30170
The except result is like this:
X:04252 X:05524 X:04176
X:05509 X:05524 X:04674
X:16629 X:10181... (3 Replies)
This is my input file :
# cat list 20130430121600, cucm, location,76,2 20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,80,8 20130430122000,cucm1,location1,90,8 20130430140000,cucm1,location1,87,11 20130430140000, cucm,location,67,9
This is the required output
... (1 Reply)
I need to delete the last 11 characters from each number and they are all in the same line (each is in a different column):
-6.89080901827020800000 3.49348891708562325136 1.47988367839905286876 -2.29707635413510400000 -3.49342364708562325136 -4.43758473239905286876 -2.29707635413510400000... (14 Replies)
I have a file as follows
ATOM 5181 N AMET K 406 12.440 6.552 25.691 0.50 7.37 N
ATOM 5182 CA AMET K 406 13.685 5.798 25.578 0.50 5.87 C
ATOM 5183 C AMET K 406 14.045 5.179 26.909 0.50 5.07 C
ATOM 5184 O MET K... (14 Replies)
Hi,
My input files is like this
axis1 0 1 10
axis2 0 1 5
axis1 1 2 -4
axis2 2 3 -3
axis1 3 4 5
axis2 3 4 -1
axis1 4 5 -6
axis2 4 5 1
Now, these are my following tasks
1. Print a first column for every two rows that has the same value followed by a string.
2. Match on the... (3 Replies)
Hello all,
I want to consolidate my data group by cities into 4 rolled up code categories (first 2 characters of 2nd col), namely PR, GR, TY and others.
CHICAGO PR1
CHICAGO GR3
CHICAGO GR4
CHICAGO HT5
CHICAGO HT6
CHICAGO TY5
HOUSTON PR3
HOUSTON PR9
HOUSTON TY4
HOUSTON HJ5... (1 Reply)
Discussion started by: jalaj841
1 Replies
LEARN ABOUT HPUX
fold
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)