Sponsored Content
Top Forums Shell Programming and Scripting How to replace the 10th column? Post 302938370 by Scrutinizer on Sunday 15th of March 2015 09:46:23 AM
Old 03-15-2015
Try:
Code:
awk '$10==24{$10="keyword1"} $10==8{$10="keyword2"} $10==0{$10="keyword3"}1' FS=, OFS=, file

Code:
Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17
2015/03/14 15:00:04,2015/03/14 15:00:04,0,Server05,Omega-God,Beta_G,101011247,1,1,keyword1,7,0,,339083645,1,1,
2015/03/14 15:13:48,2015/03/14 09:40:38,0,Server04,Omega-God,Beta_G,101011247,5,1,keyword2,7,0,,319207661,1,1,103510841
2015/03/14 15:14:55,2015/03/14 09:40:38,0,Server04,Omega-God,Beta_G,101011247,6,1,keyword1,7,0,,319207661,1,1,
2015/03/14 15:29:56,2015/03/14 09:40:38,0,Server03,Omega-God,Beta_G,101011247,7,1,keyword1,7,0,,319207661,1,1,
2015/03/14 15:50:53,2015/03/14 09:40:38,0,Server04,Omega-God,Beta_G,101011247,8,1,keyword2,7,0,,319207661,1,1,103510841
2015/03/14 18:50:58,2015/03/14 09:40:38,0,Server04,Omega-God,Beta_G,101011247,12,0,keyword3,0,1,1,319207661,1,1,103510841
2015/03/14 18:51:03,2015/03/14 09:40:38,1,Server01,101011247,Server04,Omega-God,1,0,keyword3,0,1,1,347955199,1,1,
2015/03/14 18:51:11,2015/03/14 15:05:19,1,Server04,101011247,Server04,Omega-God,1,0,keyword3,0,1,1,347963352,1,1,


Last edited by Scrutinizer; 03-15-2015 at 11:11 AM.. Reason: Added output
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace 10th column with a new column--- Terriblly hurry

Hi Can any one tell me how to replace the 10th column in a file(comma delimted) with a new file with a single column. Can any one Help me out of the please as soon as possible as i am in a terribley hurry!!!!!! Many THanks, (2 Replies)
Discussion started by: ahmedwaseem2000
2 Replies

2. Shell Programming and Scripting

Replace 10th Field by 2

Hello, I need some help ....i have a file with many number of fields i want to replace the 10th field of the file by number 2 .Also the delimeter of the file is | . Pls suggest and help.. Regards, (2 Replies)
Discussion started by: PradeepRed
2 Replies

3. UNIX for Advanced & Expert Users

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"... (3 Replies)
Discussion started by: sumeet
3 Replies

4. Shell Programming and Scripting

awk/sed column replace using column header - help

$ cat log.txt Name Age Sex Lcation nfld alias xsd CC 25 M XYZ asx KK Y BB 21 F XAS awe SS N SD 21 M AQW rty SD A How can I replace the column with header "Lcation" with the column with header "alias" and delete the "alias" column? so that the final output will become: Name Age Sex... (10 Replies)
Discussion started by: jkl_jkl
10 Replies

5. UNIX and Linux Applications

Replace string in unix from 10th column onwards

Hi All, I need to replace the last 19 bytes of the following string My_Org_Testing_20090102_231124.txt (Text_Date_Time.txt). I would like to derive the current time using "date +%Y%m%d_%H%M%S.txt" and replace the last 19 bytes of the above string I would appreciate if someone could... (3 Replies)
Discussion started by: rpk2008
3 Replies

6. 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

7. Shell Programming and Scripting

Replace column that matches specific pattern, with column data from another file

Can anyone please help with this? I have 2 files as given below. If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value. file1 abc_1 foo1@a .... abc_1 soo2@a ... def_2 soo2@a .... def_2 foo1@a ........ (7 Replies)
Discussion started by: prashali
7 Replies

8. Shell Programming and Scripting

Get extract and replace column with link in a column where it exists

hi i have sample data a,b,c,d,e,g h http://mysite.xyx z,b,d,f,e,s t http://123124# a,b,c,i,m,nothing d,i,j,e,w,nothing output expected is a,b,c,d,e,http://mysite.xyx z,b,d,f,e,http://123124# a,b,c,i,m,nothing d,i,j,e,w,nothing i can get only links using grep -o 'http.*' i... (8 Replies)
Discussion started by: zozoo
8 Replies

9. Shell Programming and Scripting

Change 10th column formatting.

Hi Experts, I created a powershell script to fetch user details from active directory and export it to a csv/excel. "abc","bcd","devloper;admin" "bcd","dca","tester;QA;admin" So here user abc is member of devloper and admin group and user bcd is a member of tester,QA and admin... (6 Replies)
Discussion started by: shekhar_4_u
6 Replies

10. UNIX for Beginners Questions & Answers

awk script to extract a column, replace one of the header and replace year(from ddmmyy to yyyy)

I have a csv which has lot of columns . I was looking for an awk script which would extract a column twice. for the first occurance the header and data needs to be intact but for the second occurance i want to replace the header name since it a duplicate and extract year value which is in ddmmyy... (10 Replies)
Discussion started by: Kunalcurious
10 Replies
ofm2opl(1)							       Omega								ofm2opl(1)

NAME
ofm2opl - convert Omega and TeX font-metric files to property-list files SYNOPSIS
ofm2opl [OPTIONS] OFMNAME[.ofm] [OPLFILE[.opl]] DESCRIPTION
ofm2opl translates a binary Omega Font Metrics file, OFMNAME, into a human-readable property-list form. The program writes to standard output (by default) or to a file specified as OPLFILE. The program also works with TeX TFM files, producing TeX PL files. (ofm2opl is based on the WEB source code for tftopl(1).) OPTIONS
-charcode-format=TYPE output character codes according to TYPE, which can be either `hex' or `ascii'. Default is `hex'. ascii specifes all ASCII letters and digits; hex gets you everything else. -help display a brief summary of syntax and options -verbose display progress reports -version output version information and exit FILES
OFMNAME an Omega Font Metric file OPLFILE an Omega Property List file BUGS
None known, but report any found to <omega@ens.fr> (mailing list). You may also want to check to see if the same bug is present in pltotf(1). SEE ALSO
omega(1), opl2ofm(1), pltotf(1), tftopl(1). Draft Manual for the Omega System (omega-manual.dvi). Web page: <http://www.gutenberg.eu.org/omega/> AUTHOR
According to the WEB documentation: The first TFtoPL program was designed by Leo Guibas in the summer of 1978. Contributions by Frank Liang, Doug Wyatt, and Lyle Ramshaw also had a significant effect on the evolution of the present code. Extensions for an enhanced ligature mechanism were added by D.E. Knuth in 1989. Extensions to handle extended font metric files (``OFM'') were added by John Plaice in December 1995 and January 1996, resulting in the new program OFM2OPL. The primary authors of Omega are John Plaice <plaice@cse.unsw.edu.au> and Yannis Haralambous <yannis@fluxus-virus.com>. This manual page was written by C.M. Connelly <cmc@debian.org>, for the Debian GNU/Linux system. It may be used by other distributions without contacting the author. Any mistakes or omissions in the manual page are my fault; inquiries about or corrections to this manual page should be directed to me (and not to the primary author). Omega September 2000 ofm2opl(1)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy