01-25-2013
the code runs perfect with the sample data,
One of my actual input files has col 2 as col 8, and col 3 as col 7.
I can replace $2 by $8, what should i replace $4 with ? there is no mention of col3 in the code.
Sorry for the naive question :-/
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hello Can Any1 tell me the difference between the col command and the col command with the -f option.
I tried running both of them but i can't see any difference.
Please guide me. (1 Reply)
Discussion started by: rahulrathod
1 Replies
2. UNIX for Dummies Questions & Answers
Hello every1.
Can any1 help me with the col command.
Wat is a reverse line feed.
Which kind of files u need to use the col command. (2 Replies)
Discussion started by: rahulrathod
2 Replies
3. Shell Programming and Scripting
Hi Guys...
I am newbie to awk and would like a solution to probably one of the simple practical questions.
I have a test file that goes as:
1,2,3,4,5,6
7,2,3,8,7,6
9,3,5,6,7,3
8,3,1,1,1,1
4,4,2,2,2,2
I would like to know how AWK can get me the distinct values say for eg: on col2... (22 Replies)
Discussion started by: anduzzi
22 Replies
4. Ubuntu
Hello,
I have a 1.6 GB file that I would like to modify by matching some ids in col1 with the ids in col 1 of file2.txt and save the results into a 3rd file.
For example:
File 1 has 1411 rows, I ignore how many columns it has (thousands)
File 2 has 311 rows, 1 column
Would like to... (7 Replies)
Discussion started by: sogi
7 Replies
5. Shell Programming and Scripting
SW_dist_intr false Enable SW distribution of interrupts True
autorestart true Automatically REBOOT OS after a crash True
boottype disk N/A False
capacity_inc 1.00 ... (7 Replies)
Discussion started by: maxim42
7 Replies
6. Shell Programming and Scripting
Hi to all.
In the following example, how can I delete the first blank of the first col? (using shell scripting)
first second third fourth
fifth sixth seventh eighth
Thank's for reading. (5 Replies)
Discussion started by: daniel.gbaena
5 Replies
7. UNIX for Advanced & Expert Users
Hello everyone,
I am writing a script to process data from the ATP world tour.
I have a file which contains:
t=540 y=2011 r=1 p=N409
t=540 y=2011 r=2 p=N409
t=540 y=2011 r=3 p=N409
t=540 y=2011 r=4 p=N409
t=520 y=2011 r=1 p=N409
t=520 y=2011 r=2 p=N409
t=520 y=2011 r=3 p=N409
The... (4 Replies)
Discussion started by: imahmoud
4 Replies
8. Shell Programming and Scripting
Hello,
I have some tab delimited data and I need to move the last col. I could hard code it,
awk '{ print $1,$NF,$2,$3,$4,etc }' infile > outfile
but it would be nice to know the syntax to print a range cols.
I know in cut you can do,
cut -f 1,4-8,11-
to print fields 1,... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
9. Shell Programming and Scripting
Hi Gurus,
I have requirement to identify the records based on one column value.
the sample file as below:
ID AMT, AMT1
100,10, 2
100,20, 3
200,30, 0
200, 40, 0
300, 20, 2
300, 50, 2
400, 20, 1
400, 60, 0
for each ID, there 2 records, if any one record amt1 is 0, the in 4th col add... (5 Replies)
Discussion started by: ken6503
5 Replies
10. Emergency UNIX and Linux Support
Hello Friends,
Hope all are doing fine.
Here is a tricky issue.
my input file is like this
07 10 14 20 21
03 15 27 30 32
01 10 11 19 30
02 06 14 15 17
01 06 20 25 29
Logic:
1. Please print another column as "0-0-0-0-0" for the first and second rows.
2. Read the first column... (4 Replies)
Discussion started by: jacobs.smith
4 Replies
COL(1) General Commands Manual COL(1)
NAME
col - filter reverse line feeds
SYNOPSIS
col [ -bfh ]
DESCRIPTION
Col reads the standard input and writes the standard output. It performs the line overlays implied by reverse line feeds (ESC-7 in ASCII)
and by forward and reverse half line feeds (ESC-9 and ESC-8). Col is particularly useful for filtering multicolumn output made with the
`.rt' command of nroff and output resulting from use of the tbl(1) preprocessor.
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.
If the -b option is given, col assumes that the output device in use is not capable of backspacing. In this case, if several characters
are to appear in the same place, only the last one read will be taken.
The control characters SO (ASCII code 017), and SI (016) are assumed to start and end text in an alternate character set. The character
set (primary or alternate) associated with each printing character read is remembered; on output, SO and SI characters are generated where
necessary to maintain the correct treatment of each character.
If the -h option is given, col converts white space to tabs to shorten printing time.
All control characters are removed from the input except space, backspace, tab, return, newline, ESC (033) followed by one of 7, 8, 9, SI,
SO, and VT (013). This last character is an alternate form of full reverse line feed, for compatibility with some other hardware conven-
tions. All other non-printing characters are ignored.
SEE ALSO
troff(1), tbl(1)
BUGS
Can't back up more than 128 lines.
No more than 800 characters, including backspaces, on a line.
7th Edition May 16, 1986 COL(1)