03-29-2005
File Manipulation (Move Column Position)
Hi All,
I have a comma separated value (.CSV) file like the one below. The file contains about 20000 lines.
FileName
EmpNo,Name,Age,Sex,Band,Spouse,Children,Salary,
1000,Arnold,24,M,B,N.A.,No,10000,
1001,Jenny,27,F,C,John,2,20000,
...................................
What i need is to make a new file which has Salary as the fourth column.
FileName2
EmpNo,Name,Age,Salary,Sex,Band,Spouse,Children,
1000,Arnold,24,10000,M,B,N.A.,No,
1001,Jenny,27,20000,F,C,John,2,
..........................................
How can we accomplish this by making use of "awk"? Any sample code is most welcome..
Thanks in advance,
Ultimate
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a tab delimited input file with say 4 fields (columns) as below :
0000443 1AGPR061 2006 Daiml
0002198 1B3XG0K2 1989 Chdds
0002199 1Bd64J0L 1990 Ch34s
0002275 1B3s4J0K 1989 Chadys
0002276 1B465302 2002 Dageml
0002290 1B45430K 1989 Cays
I want the 2nd column in file to... (5 Replies)
Discussion started by: net
5 Replies
2. Shell Programming and Scripting
Hi,
How can i move to particular line and to a particular position in a file using unix commands ?
eg: in the line 30 and position 10 i want to print my name in a file.
Cheers,
Mohan (1 Reply)
Discussion started by: mohanpadamata
1 Replies
3. 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
4. Shell Programming and Scripting
Hi,
Let say I have a file which has around 400 fields.
SampleFile
=========
PATIENTID|FACILITY|................|TIME_LAST_VISITED_BY_MD|.....|STATUS|
How is it possible to find out which field is TIME_LAST_VISITED_BY_MD?fro example by seeing the above structure we can saw FACILITY... (5 Replies)
Discussion started by: machomaddy
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a tab delimited text file with three different columns. I want to add an extra column to the text file. The extra column will be the second column and it will equal third column - 1. How do I go about doing that? Thanks!
Input:
chr1 788822 rs11240777
chr1 1008567 rs9442372... (2 Replies)
Discussion started by: evelibertine
2 Replies
6. Shell Programming and Scripting
i have this prob
I have some records in a file1 like this
1001 sajal singh tampa
1002 .... so on
i have a pattern file which is like this
1,4 4,13 14,15
i have to read the first pair 1,4 and extract that from the first record
so the pattern is 1001
now i have to scramble 1001... (1 Reply)
Discussion started by: spankincubus
1 Replies
7. Shell Programming and Scripting
Currently the table looks like this
student-id,last,first,hwk1,hwk2,hwk3,exam1,hwk4,hwk5,exam2
pts-avail,,,100,150,100,200,100,150,300
991-78-7872,Thompson,Ken,95,143,79,185,95,135,259
123-45-6789,Richie,Dennis,99,123,89,189,97,139,279
234-56-7891,Aho,Al,78,146,75,176,88,128,285... (3 Replies)
Discussion started by: ertang
3 Replies
8. UNIX for Advanced & Expert Users
In a space delimited file how would you go about removing 2 and 3 column of a file and add "word" to the first column of the file in both awk and vi? (2 Replies)
Discussion started by: cokedude
2 Replies
9. Shell Programming and Scripting
Identify the First Column Position in Second Column and add the position value in 3rd column.
Sample data:
a|c
b|d
c|a
d|b
e|e
f|g
g|f
|h
|i
Expected Output:
a|c|1
b|d|2
c|a|3
d|b|4 (6 Replies)
Discussion started by: BrahmaNaiduA
6 Replies
10. Shell Programming and Scripting
Hi everyone..
I have a list of values in a file...
a,
b,
c,
1,
2,
3,
aaaa,
bbbbb,
I am interested in converting this column to a row..
"text",aaaa,
bbbb
a,1 (7 Replies)
Discussion started by: manihi
7 Replies
LEARN ABOUT DEBIAN
sctp_test
sctp_test(1) General Commands Manual sctp_test(1)
NAME
sctp_test - Send and receive messages via SCTP
SYNOPSIS
sctp_test -H -P -h -p -l|s
DESCRIPTION
This is a userspace test application for the SCTP Linux kernel reference implementation.
OPTIONS
-H local-addr
-P local-port
-h remote-addr
-p remote-port
-s Act as client
-l Listen for connections (server)
-a assoc_pattern
assoc_pattern in the mixed mode 0 = sequential ascending(default) 1 = random
-d debug
0 = none 1 = min(default) 2 = max
-c testcase
0 = 1 byte packets. 1 = 1352 byte packets.
(fragmentation point for an i/f with 1500 as mtu.) 2 = 1353 byte packets.
(min. size at which fragmentation occurs
for an i/f with 1500 as mtu.) 3 = Sequence of 1, 1353, 32768 byte packets. 4 = Sequence of following size packets.
(1, 1000, 2000, 3000, 5000, 10000,15000, 20000, 25000, 32768) 5 = 32768 byte packets.
(default max receive window size.) 6 = random size packets.
-ve value
Packets of specifed size.
-m msgsize
(1500-65515, default value 32768)
-x number_of_repeats
-o order_pattern
0 = all unordered(default) 1 = all ordered 2 = alternating 3 = random -t stream_pattern
0 = sequential ascending(default)
1 = random -M max_stream (default value 0) -r seed (default 0, use time()) -L num_ports (default value 0). Run the mixed mode -S
num_ports (default value 0). Run the mixed mode -D Drain. If in client mode do a read following send.
USAGE
server: sctp_test -H local_addr -P local_port -l
client: sctp_test -H local_addr -P local_port -h remote_addr
-p remote-port -s
AUTHOR
Michael Biebl <biebl@debian.org>
sctp_test(1)