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
AUINFO(1) General Commands Manual AUINFO(1)
NAME
auinfo - show information about a Network Audio System server
SYNOPSIS
auinfo [-audio servername]
DESCRIPTION
The auinfo program provides information describing a Network Audio System server. It lists the capabilities of the server, the devices
that are attached to it, the data formats that are accepted, and any predefined sounds that have been stored in the server.
EXAMPLE
The following example shows the output produced by auinfo when connected to an NCD MCX(tm) display station:
Audio Server: tcp/lemkemcx:8000
Version Number: 2.0
Vendor: Network Computing Devices Inc.
Vendor Release: 3000
Min Sample Rate: 1000
Max Sample Rate: 52000
Max Tracks: 32
Number of Formats: 7
Formats: ULAW8 LinearUnsigned8 LinearSigned8
LinearSigned16MSB LinearUnsigned16MSB
LinearSigned16LSB LinearUnsigned16LSB
Number of Elem Types: 11
Element Types: ImportClient ImportDevice ImportBucket Bundle
MultiplyConstant AddConstant Sum ExportClient
ExportDevice ExportBucket ExportMonitor
Number of Wave Forms: 0
Number of Actions: 2
Actions: ChangeState SendNotify
Number of Devices: 5
Device 0:
Changable: Gain LineMode
ID: 0x34
Kind: PhysicalInput
Use: Import
Format: LinearSigned16MSB
Num Tracks: 1
Access: Import List
Description: "Mono Channel Input"
Min Rate: 1000
Max Rate: 52000
Location: Left Right External
Gain Percent: 15
Line Mode: High
Device 1:
Changable: Gain
ID: 0x32
Kind: PhysicalOutput
Use: Export
Format: LinearSigned16MSB
Num Tracks: 2
Access: Export List
Description: "Stereo Channel Output"
Min Rate: 1000
Max Rate: 52000
Location: Left Right External
Gain Percent: 24
Num Children: 2
Children: 0x30 0x31
Device 2:
Changable: Gain
ID: 0x33
Kind: PhysicalOutput
Use: Export
Format: LinearSigned16MSB
Num Tracks: 1
Access: Export List
Description: "Mono Channel Output"
Min Rate: 1000
Max Rate: 52000
Location: Left Right External
Gain Percent: 24
Num Children: 2
Children: 0x30 0x31
Device 3:
Changable: Gain
ID: 0x31
Kind: PhysicalOutput
Use: Export
Format: LinearSigned16MSB
Num Tracks: 1
Access: Export List
Description: "Right Channel Output"
Min Rate: 1000
Max Rate: 52000
Location: Right External
Gain Percent: 24
Num Children: 0
Device 4:
Changable: Gain
ID: 0x30
Kind: PhysicalOutput
Use: Export
Format: LinearSigned16MSB
Num Tracks: 1
Access: Export List
Description: "Left Channel Output"
Min Rate: 1000
Max Rate: 52000
Location: Left External
Gain Percent: 24
Num Children: 0
Number of Buckets: 0
Bucket 0:
ID: 0x1400008
Kind: Bucket
Use: Import Export
Format: ULAW8
Num Tracks: 1
Access: Import Export Destroy List
Description: "Monty Python - Australian Table Wines"
Sample Rate: 8000
Num Samples: 697944
Bucket 1:
ID: 0x1400007
Kind: Bucket
Use: Import Export
Format: LinearUnsigned8
Num Tracks: 1
Access: Import Export Destroy List
Description: ""I'm sorry Dave, I can't do that" - HAL from 2001"
Sample Rate: 22255
Num Samples: 85504
Bucket 2:
ID: 0x1400006
Kind: Bucket
Use: Import Export
Format: LinearUnsigned8
Num Tracks: 1
Access: Import Export Destroy List
Description: ""He's dead, Jim" - Dr. McCoy"
Sample Rate: 11128
Num Samples: 31602
ENVIRONMENT
AUDIOSERVER
This variable specifies the default audio server to contact if -audio is not specified on the command line.
DISPLAY If AUDIOSERVER is not set, this variable is examined to find the name of the corresponding X Window System display.
SEE ALSO
nas(1)
COPYRIGHT
Copyright 1993, 1994 Network Computing Devices, Inc.
See nas(1) for a full statement of rights and permissions.
AUTHOR
Jim Fulton, Network Computing Devices, Inc.
1.9.3 AUINFO(1)