Sponsored Content
Top Forums UNIX for Advanced & Expert Users replace a column values with the first value in column Post 302106067 by sumeet on Tuesday 6th of February 2007 10:59:27 AM
Old 02-06-2007
replace a column values with the first value in column

Hi All,

I have a file which has data in following format:

"Body_Model","2/1/2007","2/1/2007"
"CSCH74","0","61"
"CSCS74","0","647"
"CSCX74","0","3"
"CSYH74","0","299"
"CSYS74","0","2514"
"CSYX74","0","3"
"Body_Model","3/1/2007","3/1/2007"
"CSCH74","0","88"
"CSCS74","0","489"
"CSCX74","0","4"
"CSYH74","0","386"
"CSYS74","0","1871"
"CSYX74","0","4"

I want to have to convert to get following :

"Body_Model","2/1/2007","2/1/2007"
"CSCH74","2/1/2007","61"
"CSCS74","2/1/2007","647"
"CSCX74","2/1/2007","3"
"CSYH74","2/1/2007","299"
"CSYS74","2/1/2007","2514"
"CSYX74","2/1/2007","3"
"Body_Model","3/1/2007","3/1/2007"
"CSCH74","3/1/2007","88"
"CSCS74","3/1/2007","489"
"CSCX74","3/1/2007","4"
"CSYH74","3/1/2007","386"
"CSYS74","3/1/2007","1871"
"CSYX74","3/1/2007","4"

Can any of Unix Gurus help me.

Thanks
Sumeet
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace the column values.

I have the below file ...where some of the column values should replaced with desired values ....below file u can find that 3 column where ever 'AAA' comes should replaced with ' CC ' NOTE : we have to pass the column number ,AAA,CC (modified value) as the parameters to the code. ... (6 Replies)
Discussion started by: charandevu
6 Replies

2. Shell Programming and Scripting

print unique values of a column and sum up the corresponding values in next column

Hi All, I have a file which is having 3 columns as (string string integer) a b 1 x y 2 p k 5 y y 4 ..... ..... Question: I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies

3. Shell Programming and Scripting

Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2

Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2 file 1 sample SNDK 80004C101 AT XLNX 983919101 BB NETL 64118B100 BS AMD 007903107 CC KLAC 482480100 DC TER 880770102 KATS ATHR 04743P108 KATS... (7 Replies)
Discussion started by: rydz00
7 Replies

4. UNIX for Dummies Questions & Answers

Replace values in a specified column of a file

Hello, I have a file with four columns and I would like to replace values in the second column only. An arbitrary example is: 100 A 105 B 200 B 205 C 300 C 305 D 400 D 405 E 500 E 505 F I need to replace the second column as shown below: ... (4 Replies)
Discussion started by: Gussifinknottle
4 Replies

5. UNIX for Dummies Questions & Answers

replace a column with values from another file

Dear all, I have a file1.pdb in pdb format and a dat file2 containing values, corresponding to the atoms in the pdb file. these values (file2.dat) need to be in the column instead of the 0.00 (file1) values for each atom in file1.pdb .(the red values must be replaced by the blue ones,in order)... (11 Replies)
Discussion started by: chen.xiao.po
11 Replies

6. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

7. Shell Programming and Scripting

Replace column values from other file

I have one file as it has the following format File1 S No Site IP Address 1 Australia 192.168.0.1/26 2 Australia 192.168.0.2/26 3 Australia 192.168.0.3/26 I need awk/sed command to replace the column2 value ( under Site) with some other... (8 Replies)
Discussion started by: samaritan
8 Replies

8. UNIX for Dummies Questions & Answers

Replace all decimal values in a column

Hi My input file looks String000002 GeneWise CW 48945 49354 . - 0 Pt=PEQU_00004; String000002 LEN NA 52125 52604 0.945751 - . PID=PEQU_00005;lvid_id=PEQ_28708; String000002 LEN CW 52125 52604 . - 0 ... (3 Replies)
Discussion started by: siya@
3 Replies

9. Shell Programming and Scripting

Trying to get an awk script to replace values in column

I'm trying to make an awk script to compare values I've set as var1, var2, and var3 earlier in the script to the values in the userinputted column of four text files called Node1.txt, Node2.txt, Node3.txt, and Node4.txt and then replace the values in that userinputted column with either ttt or gcc,... (8 Replies)
Discussion started by: Eric1
8 Replies

10. UNIX for Beginners Questions & Answers

Replace a numeric values in a certain column

Hi All, I am trying to replace a certain value from one place in a file . In the below file at position 35 I will have 8 I need to modify all 8 in that position to 7 I tried awk '{gsub("8","7",$35)}1' infile > outfile ----> not working sed -i 's/8/7'g' infile --- it is replacing all... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
gnustep-config(1)					       GNUstep System Manual						 gnustep-config(1)

NAME
gnustep-config - prints information about the current gnustep installation. SYNOPSIS
gnustep-config [ --variable=variable |--objc-flags|--objc-libs|--base-libs|--gui-libs ] DESCRIPTION
gnustep-config can print information about the currently installed GNUstep system. It can output dependend on the options used the differ- ent flags used for compilation, but also the different internal variables used by the make system. OPTIONS
--variable=variable prints the value of the specified variable. Possible variables are: GNUSTEP_MAKEFILES GNUSTEP_USER_DIR GNUSTEP_USER_DEFAULTS_DIR GNUSTEP_HOST GNUSTEP_HOST_CPU GNUSTEP_HOST_VENDOR GNUSTEP_HOST_OS GNUSTEP_IS_FLATTENED GNUSTEP_xxx_APPS GNUSTEP_xxx_TOOLS GNUSTEP_xxx_LIBRARY GNUSTEP_xxx_HEADERS GNUSTEP_xxx_LIBRARIES GNUSTEP_xxx_DOC GNUSTEP_xxx_DOC_MAN GNUSTEP_xxx_DOC_INFO where 'xxx' could be any of 'SYSTEM', 'NETWORK', 'LOCAL' and 'USER'. --objc-flags prints all the flags required to compile an ObjC file --objc-libs prints all the flags required to link a pure ObjC program (no foundation/gui) --base-libs prints all the flags required to link a command-line ObjC program (no gui) --gui-libs prints all the flags required to link a GUI ObjC program BUGS
None known SEE ALSO
GNUstep(7) HISTORY
Work on gnustep-config started in 2007 by Nicola Pero <nicola.pero@meta-innovation.com> AUTHORS
This man page was written by Dennis Leeuw <dleeuw@made-it.com>. COPYRIGHT
Copyright (C) 2007 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. GNUstep 24/12/2007 gnustep-config(1)
All times are GMT -4. The time now is 02:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy