9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I am trying to select the rows in a fixed width file based on values in the columns.
I want to select only the rows if column position 3-4 has the value AB
I am using cut command to get the column values. Is it possible to check if cut -c3-4 = AB is true then select only that... (2 Replies)
Discussion started by: ashok.k
2 Replies
2. Shell Programming and Scripting
hi,
i have a fixed width file with multiple columns and need to print data using awk command.
i use: awk -F "|" '($5 == BH) {print $1,$2,$3}' <non_AIM target>.txt for a delimiter file.
but now i have a fixed width file like below:
7518 8269511BH 20141224951050N8262
11148 8269511BH... (5 Replies)
Discussion started by: kcdg859
5 Replies
3. Shell Programming and Scripting
I have a fixed with file with header & trailer length having the same length of the detail record file.
The details record length of this file is 24, for Header and Trailer the records will be padded with spaces to match the record length of the file
Currently I am adding 3 spaces in header... (14 Replies)
Discussion started by: ginrkf
14 Replies
4. Shell Programming and Scripting
Hi,
I have a fixed width text file without any header row. One of the columns contains a date in YYYYMMDD format.
If the original file contains 3 dates, I want my shell script to split the file into 3 small files with data for each date.
I am a newbie and need help doing this. (14 Replies)
Discussion started by: bhanja_trinanja
14 Replies
5. UNIX for Dummies Questions & Answers
Hi,
How to output the duplicate record to another file. We say the record is duplicate based on a column whose position is from 2 and its length is 11 characters.
The file is a fixed width file.
ex of Record:
DTYU12333567opert tjhi kkklTRG9012
The data in bold is the key on which... (1 Reply)
Discussion started by: Qwerty123
1 Replies
6. Shell Programming and Scripting
Dear friends,
Below is my program and current output. I wish to have 3 or 4 column output in order to accomodate in single page. i do have subsequent command to process after user enter the number.
Program
COUNT=1
for MYDIR in `ls /`
do
VOBS=${MYDIR}
echo "${COUNT}. ${MYDIR}"
... (4 Replies)
Discussion started by: baluchen
4 Replies
7. Shell Programming and Scripting
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)
Discussion started by: manneni prakash
5 Replies
8. Shell Programming and Scripting
Col1 Col2 Col3 Col4
12 Completed 08 0830
12 In Progress 09 0829
11 For F U 07 0828
Considering the file above, how could i replace the third column the most efficient way? The actual file size is almost 1G. I am... (10 Replies)
Discussion started by: tamahomekarasu
10 Replies
9. Shell Programming and Scripting
Hi, I have two input files.
File1:
ID Name Place
1-234~name1~Newyork
1-34~name2~Boston
1-2345~name3~Hungary
File1 is a variable length file where each column is seperated by delimitter "~".
File2:
ID Country
1-34<<11 SPACES>>USA<<7 spaces>>
1-234<<10 SPACES>>UK<<8... (5 Replies)
Discussion started by: manneni prakash
5 Replies
PR(1) BSD General Commands Manual PR(1)
NAME
pr -- print files
SYNOPSIS
pr [+page] [-column] [-adFfmprt] [[-e] [char] [gap]] [-L locale] [-h header] [[-i] [char] [gap]] [-l lines] [-o offset] [[-s] [char]] [[-n]
[char] [width]] [-w width] [-] [file ...]
DESCRIPTION
The pr utility is a printing and pagination filter for text files. When multiple input files are specified, each is read, formatted, and
written to standard output. By default, the input is separated into 66-line pages, each with
o A 5-line header with the page number, date, time, and the pathname of the file.
o A 5-line trailer consisting of blank lines.
If standard output is associated with a terminal, diagnostic messages are suppressed until the pr utility has completed processing.
When multiple column output is specified, text columns are of equal width. By default text columns are separated by at least one <blank>.
Input lines that do not fit into a text column are truncated. Lines are not truncated under single column output.
OPTIONS
In the following option descriptions, column, lines, offset, page, and width are positive decimal integers and gap is a nonnegative decimal
integer.
+page
Begin output at page number page of the formatted input.
-column
Produce output that is columns wide (default is 1) that is written vertically down each column in the order in which the text is
received from the input file. The options -e and -i are assumed. This option should not be used with -m. When used with -t, the min-
imum number of lines is used to display the output. (To columnify and reshape text files more generally and without additional format-
ting, see the rs(1) utility.)
-a Modify the effect of the -column option so that the columns are filled across the page in a round-robin order (e.g., when column is 2,
the first input line heads column 1, the second heads column 2, the third is the second line in column 1, etc.). This option requires
the use of the -column option.
-d Produce output that is double spaced. An extra <newline> character is output following every <newline> found in the input.
-e [char][gap]
Expand each input <tab> to the next greater column position specified by the formula n*gap+1, where n is an integer > 0. If gap is
zero or is omitted the default is 8. All <tab> characters in the input are expanded into the appropriate number of <space>s. If any
nondigit character, char, is specified, it is used as the input tab character.
-F Use a <form-feed> character for new pages, instead of the default behavior that uses a sequence of <newline> characters.
-f Same as -F but pause before beginning the first page if standard output is a terminal.
-h header
Use the string header to replace the file name in the header line.
-i [char][gap]
In output, replace multiple <space>s with <tab>s whenever two or more adjacent <space>s reach column positions gap+1, 2*gap+1, etc. If
gap is zero or omitted, default <tab> settings at every eighth column position is used. If any nondigit character, char, is specified,
it is used as the output <tab> character.
-L locale
Use locale specified as argument instead of one found in environment. Use "C" to reset locale to default.
-l lines
Override the 66 line default and reset the page length to lines. If lines is not greater than the sum of both the header and trailer
depths (in lines), the pr utility suppresses output of both the header and trailer, as if the -t option were in effect.
-m Merge the contents of multiple files. One line from each file specified by a file operand is written side by side into text columns of
equal fixed widths, in terms of the number of column positions. The number of text columns depends on the number of file operands suc-
cessfully opened. The maximum number of files merged depends on page width and the per process open file limit. The options -e and -i
are assumed.
-n [char][width]
Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column posi-
tions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to
separate it from whatever follows. The default for char is a <tab>. Line numbers longer than width columns are truncated.
-o offset
Each line of output is preceded by offset <spaces>s. If the -o option is not specified, the default is zero. The space taken is in
addition to the output line width.
-p Pause before each page if the standard output is a terminal. pr will write an alert character to standard error and wait for a car-
riage return to be read on the terminal.
-r Write no diagnostic reports on failure to open a file.
-s char
Separate text columns by the single character char instead of by the appropriate number of <space>s (default for char is the <tab>
character).
-t Print neither the five-line identifying header nor the five-line trailer usually supplied for each page. Quit printing after the last
line of each file without spacing to the end of the page.
-w width
Set the width of the line to width column positions for multiple text-column output only. If the -w option is not specified and the -s
option is not specified, the default width is 72. If the -w option is not specified and the -s option is specified, the default width
is 512.
file A pathname of a file to be printed. If no file operands are specified, or if a file operand is '-', the standard input is used. The
standard input is used only if no file operands are specified, or if a file operand is '-'.
The -s option does not allow the option letter to be separated from its argument, and the options -e, -i, and -n require that both arguments,
if present, not be separated from the option letter.
EXIT STATUS
The pr utility exits 0 on success, and >0 if an error occurs.
DIAGNOSTICS
If pr receives an interrupt while printing to a terminal, it flushes all accumulated error messages to the screen before terminating.
Error messages are written to standard error during the printing process (if output is redirected) or after all successful file printing is
complete (when printing to a terminal).
SEE ALSO
cat(1), more(1), rs(1)
STANDARDS
The pr utility is IEEE Std 1003.1-2001 (``POSIX.1'') compatible.
HISTORY
A pr command appeared in Version 1 AT&T UNIX.
BUGS
The pr utility does not recognize multibyte characters.
BSD
July 3, 2004 BSD