Hi,
I have a file that has several values seperated by ":"
2006:John:Student:Football:Portugal:Cinema
2006:James:Engineer:Basket:Poland:Theatre
2007:Lucy:Diver:Gymnastic:England:Music
2007:Smith:Plumber:Basket:Spain:Poker
I need make a filter based on the 5th field to find countries that... (1 Reply)
HI,
Your help was great: awk -F":" '$5 ~ /^P/{print }' file
I would like to know what changes need to be done to this line code, so that I can put it in a shell script and call it as the example below.
example: countries that start with chacater 'P'
> country P
Result:
... (0 Replies)
First I have to say thank you to this community and this forum. You helped me very much builing several useful scripts.
Now, I can't get a solution the following problem, I'm stuck somehow. Maybe someone has an idea.
In short, I dump a site via lynx and pipe the output in a file. I need to... (7 Replies)
Dear all,
Does anyone know how I could to add a column of numbers (1s, or 2s, or..., or 6s) to two-column text files (tab-delimited), where the specific number to be added varies as a function of the file naming?
Currently, each of my text files has two columns, so the column with the... (12 Replies)
Hi,
I have the following text file:
8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm
9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm
10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm
11 T1mapping_flip15 ok 128 108 30... (2 Replies)
My scenario is that I need to pick value from third column based on fourth column value, if fourth column value is 1 then first value of third column.Third column (2|3|4|6|1) values are cancatenated.
Please someone help me to resolve this issue.
Source
column1 column2 column3 column4... (2 Replies)
Hi ALL,
I have two file. I need to combine these two file based on a layout.
I used the below code and able to extract the record. But now able to insert that to a 3'rd file in between the extract
FILE 1
CAID NUMBER 1-20
TID NUMBER 21-22
LABEL CHAR 23-44
BASE 45-60... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
LEARN ABOUT OPENSOLARIS
fold
fold(1) User Commands fold(1)NAME
fold - filter for folding lines
SYNOPSIS
fold [-bs] [-w width | -width] [file]...
DESCRIPTION
The fold utility is a filter that will fold lines from its input files, breaking the lines to have a maximum of width column positions (or
bytes, if the -b option is specified). Lines will be broken by the insertion of a NEWLINE character such that each output line (referred to
later in this section as a segment) is the maximum width possible that does not exceed the specified number of column positions (or bytes).
A line will not be broken in the middle of a character. The behavior is undefined if width is less than the number of columns any single
character in the input would occupy.
If the CARRIAGE-RETURN, BACKSPACE, or TAB characters are encountered in the input, and the -b option is not specified, they will be treated
specially:
BACKSPACE The current count of line width will be decremented by one, although the count never will become negative. fold will
not insert a NEWLINE character immediately before or after any BACKSPACE character.
CARRIAGE-RETURN The current count of line width will be set to 0. fold will not insert a NEWLINE character immediately before or after
any CARRIAGE-RETURN character.
TAB Each TAB character encountered will advance the column position pointer to the next tab stop. Tab stops will be at each
column position n such that n modulo 8 equals 1.
OPTIONS
The following options are supported:
-b Counts width in bytes rather than column positions.
-s If a segment of a line contains a blank character within the first width column positions (or bytes), breaks the line
after the last such blank character meeting the width constraints. If there is no blank character meeting the require-
ments, the -s option will have no effect for that output segment of the input line.
-w width|-width Specifies the maximum line length, in column positions (or bytes if -b is specified). If width is not a positive deci-
mal number, an error is returned. The default value is 80.
OPERANDS
The following operand is supported:
file A path name of a text file to be folded. If no file operands are specified, the standard input will be used.
EXAMPLES
Example 1 Submitting a file of possibly long lines to the line printer
An example invocation that submits a file of possibly long lines to the line printer (under the assumption that the user knows the line
width of the printer to be assigned by lp(1)):
example% fold -w 132 bigfile | lp
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of fold: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 All input files were processed successfully.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO cut(1), pr(1), attributes(5), environ(5), standards(5)NOTES
fold and cut(1) can be used to create text files out of files with arbitrary line lengths. fold should be used when the contents of long
lines need to be kept contiguous. cut should be used when the number of lines (or records) needs to remain constant.
fold is frequently used to send text files to line printers that truncate, rather than fold, lines wider than the printer is able to print
(usually 80 or 132 column positions).
fold may not work correctly if underlining is present.
SunOS 5.11 1 Feb 1995 fold(1)