Sponsored Content
Top Forums Shell Programming and Scripting CSV file REPLACE COLUMN if it matches Post 302915171 by RavinderSingh13 on Monday 1st of September 2014 07:41:19 AM
Old 09-01-2014
Hello Aravindj80,

Could you please use code tags for commands and codes which you are using in your post. This is one of the very important rule for this forum which you have agreed during your user account creation. you can refer the forum rule guidlines also for same as follows.
https://www.unix.com/misc.php?do=cfrules

Following may help you in your requirement.

Code:
awk -F"," '($3 !~ 0) {gsub(/.*/," XXXX ",$3);} 1' OFS=","   filename

Output will be as follows.

Code:
AAAA , BBBB , XXXX , DDDD
DFDF , DFDF , XXXX , FDDD
AA11 , DFDF , 0000 , UTIO
ADSD , WERT, 0000 , JKJL

Thanks,
R. Singh

Last edited by RavinderSingh13; 09-01-2014 at 08:42 AM.. Reason: Added rules link for user
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace if regex on specific column matches expression?

I am attempting to convert rewrite rules to Nginx, and since due to the mass amount of rewrites we must convert, I've been trying to write a script to help me on a specific part, easily. So far I have this: rewrite ^action/static/(+)/$ staticPage.php?pg=$1&%$query_string; What I want done... (5 Replies)
Discussion started by: EXT3FSCK
5 Replies

2. Shell Programming and Scripting

replace a column in a file if it matches certain pattern

Hi, I want to replace a column in a file if it matches certain pattern. Can you help me on this. Here is the file content. 000000 1111111 2222222 011111 0123445 1234556 023445 1111111 2343455 if second column contains 1111111 i need to replace it with 0000000 Can you... (6 Replies)
Discussion started by: Krrishv
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. Shell Programming and Scripting

Replace 2nd column of CSV file with numbers on line

I have a csv file with occasional multiple entries in the second column. 111111,104,07-24-2011,3.15,N, 222222,020 140,07-24-2011,10.00,N,I want the result 111111,104,07-24-2011,3.15,N, 222222,020,07-24-2011,10.00,N, 222222,140,07-24-2011,10.00,N, I know I can get the output of the second... (5 Replies)
Discussion started by: ffdstanley
5 Replies

5. Shell Programming and Scripting

Replace 2nd column for each line in a csv file with fixed string+random number

Hi experts, My csv file looks like this U;cake;michael;temp;;;; U;bread;john;temp;;;; U;cocktails;sarah;temp;;;; I'd like to change the value fo 2nd column to cf+random number , which will look maybe something like this U;cf20187;michael;temp;;;; U;cf8926;john;temp;;;;... (7 Replies)
Discussion started by: tententen
7 Replies

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

7. Shell Programming and Scripting

Difference of the same column when two other column matches and one column differs less than 1 hour

This is my input file : # cat list 20130430121600, cucm, location,76,2 20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,80,8 20130430122000,cucm1,location1,90,8 20130430140000,cucm1,location1,87,11 20130430140000, cucm,location,67,9 This is the required output ... (1 Reply)
Discussion started by: Lakshmikumari
1 Replies

8. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

9. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

10. Shell Programming and Scripting

Replace all string matches in file with unique random number

Hello Take this file... Test01 Ref test Version 01 Test02 Ref test Version 02 Test66 Ref test Version 66 Test99 Ref test Version 99 I want to substitute every occurrence of Test{2} with a unique random number, so for example, if I was using sed, substitution would be something... (1 Reply)
Discussion started by: funkman
1 Replies
DateTime::Locale::fa_IR(3)				User Contributed Perl Documentation				DateTime::Locale::fa_IR(3)

NAME
DateTime::Locale::fa_IR SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'fa_IR' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Persian Iran. DATA
This locale inherits from the DateTime::Locale::fa locale. It contains the following data. Days Wide (format) XXXXXX XXXXXXX XXXXXXXX XXXXXXX XXXX XXXX XXXXXX Abbreviated (format) XXXXXX XXXXXXX XXXXXXXX XXXXXXX XXXX XXXX XXXXXX Narrow (format) X X X X X X X Wide (stand-alone) XXXXXX XXXXXXX XXXXXXXX XXXXXXX XXXX XXXX XXXXXX Abbreviated (stand-alone) 2 3 4 5 6 7 1 Narrow (stand-alone) X X X X X X X Months Wide (format) XXXXXXX XXXXXX XXXX XXXXX XXX XXXX XXXXXX XXX XXXXXXX XXXXX XXXXXX XXXXXX Abbreviated (format) XXXXXXX XXXXXX XXXX XXXXX XXX XXXX XXXXXX XXX XXXXXXX XXXXX XXXXXX XXXXXX Narrow (format) X X X X X X X X X X X X Wide (stand-alone) XXXXXX XXXXX XXXX XXXXX XX XXXX XXXXX XXX XXXXXXX XXXXX XXXXXX XXXXXX Abbreviated (stand-alone) XXXXXXX XXXXXX XXXX XXXXX XXX XXXX XXXXXX XXX XXXXXXX XXXXX XXXXXX XXXXXX Narrow (stand-alone) X X X X X X X X X X X X Quarters Wide (format) XXXXXXXX XXX XXXXXXXX XXX XXXXXXXX XXX XXXXXXXX XXXXX Abbreviated (format) XXXX XXXX XXXX XXXX Narrow (format) X X X X Wide (stand-alone) XXXXXXXX XXX XXXXXXXX XXX XXXXXXXX XXX XXXXXXXX XXXXX Abbreviated (stand-alone) XXXX XXXX XXXX XXXX Narrow (stand-alone) X X X X Eras Wide XXX XX XXXXX XXXXXX Abbreviated X.X. X. Narrow X X Date Formats Full 2008-02-05T18:30:30 = XXXXXXX 5 XXXXXX 2008 1995-12-22T09:05:02 = XXXX 22 XXXXXX 1995 -0010-09-15T04:44:23 = XXXX 15 XXXXXXX -10 Long 2008-02-05T18:30:30 = 5 XXXXXX 2008 1995-12-22T09:05:02 = 22 XXXXXX 1995 -0010-09-15T04:44:23 = 15 XXXXXXX -10 Medium 2008-02-05T18:30:30 = 2008/2/5 1995-12-22T09:05:02 = 1995/12/22 -0010-09-15T04:44:23 = -010/9/15 Short 2008-02-05T18:30:30 = 08/2/5 1995-12-22T09:05:02 = 95/12/22 -0010-09-15T04:44:23 = -10/9/15 Default 2008-02-05T18:30:30 = 5 XXXXXX 2008 1995-12-22T09:05:02 = 22 XXXXXX 1995 -0010-09-15T04:44:23 = 15 XXXXXXX -10 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 (UTC) 1995-12-22T09:05:02 = 9:05:02 (UTC) -0010-09-15T04:44:23 = 4:44:23 (UTC) Long 2008-02-05T18:30:30 = 18:30:30 (UTC) 1995-12-22T09:05:02 = 9:05:02 (UTC) -0010-09-15T04:44:23 = 4:44:23 (UTC) Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 Datetime Formats Full 2008-02-05T18:30:30 = XXXXXXX 5 XXXXXX 2008X XXXX 18:30:30 (UTC) 1995-12-22T09:05:02 = XXXX 22 XXXXXX 1995X XXXX 9:05:02 (UTC) -0010-09-15T04:44:23 = XXXX 15 XXXXXXX -10X XXXX 4:44:23 (UTC) Long 2008-02-05T18:30:30 = 5 XXXXXX 2008X XXXX 18:30:30 (UTC) 1995-12-22T09:05:02 = 22 XXXXXX 1995X XXXX 9:05:02 (UTC) -0010-09-15T04:44:23 = 15 XXXXXXX -10X XXXX 4:44:23 (UTC) Medium 2008-02-05T18:30:30 = 2008/2/5X XXXX 18:30:30 1995-12-22T09:05:02 = 1995/12/22X XXXX 9:05:02 -0010-09-15T04:44:23 = -010/9/15X XXXX 4:44:23 Short 2008-02-05T18:30:30 = 08/2/5X XXXX 18:30 1995-12-22T09:05:02 = 95/12/22X XXXX 9:05 -0010-09-15T04:44:23 = -10/9/15X XXXX 4:44 Default 2008-02-05T18:30:30 = 5 XXXXXX 2008X XXXX 18:30:30 1995-12-22T09:05:02 = 22 XXXXXX 1995X XXXX 9:05:02 -0010-09-15T04:44:23 = 15 XXXXXXX -10X XXXX 4:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (EEE d) 2008-02-05T18:30:30 = XXXXXXX 5 1995-12-22T09:05:02 = XXXX 22 -0010-09-15T04:44:23 = XXXX 15 GGGGyyyyMMMMd (d MMMM y GGGG) 2008-02-05T18:30:30 = 5 XXXXXX 2008 XXXXXX 1995-12-22T09:05:02 = 22 XXXXXX 1995 XXXXXX -0010-09-15T04:44:23 = 15 XXXXXXX -10 XXX XX XXXXX HHmmZ (HH:mm (Z)) 2008-02-05T18:30:30 = 18:30 (+0000) 1995-12-22T09:05:02 = 09:05 (+0000) -0010-09-15T04:44:23 = 04:44 (+0000) Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 XXX XX XXX 1995-12-22T09:05:02 = 9:05 XXX XX XXX -0010-09-15T04:44:23 = 4:44 XXX XX XXX Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 XXX XX XXX 1995-12-22T09:05:02 = 9:05:02 XXX XX XXX -0010-09-15T04:44:23 = 4:44:23 XXX XX XXX M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M/d) 2008-02-05T18:30:30 = 2/5 1995-12-22T09:05:02 = 12/22 -0010-09-15T04:44:23 = 9/15 MEd (E M/d) 2008-02-05T18:30:30 = XXXXXXX 2/5 1995-12-22T09:05:02 = XXXX 12/22 -0010-09-15T04:44:23 = XXXX 9/15 MMM (LLL) 2008-02-05T18:30:30 = XXXXXX 1995-12-22T09:05:02 = XXXXXX -0010-09-15T04:44:23 = XXXXXXX MMMd (d LLL) 2008-02-05T18:30:30 = 5 XXXXXX 1995-12-22T09:05:02 = 22 XXXXXX -0010-09-15T04:44:23 = 15 XXXXXXX MMMEd (E d LLL) 2008-02-05T18:30:30 = XXXXXXX 5 XXXXXX 1995-12-22T09:05:02 = XXXX 22 XXXXXX -0010-09-15T04:44:23 = XXXX 15 XXXXXXX MMMMd (d LLLL) 2008-02-05T18:30:30 = 5 XXXXX 1995-12-22T09:05:02 = 22 XXXXXX -0010-09-15T04:44:23 = 15 XXXXXXX MMMMEd (E d LLLL) 2008-02-05T18:30:30 = XXXXXXX 5 XXXXX 1995-12-22T09:05:02 = XXXX 22 XXXXXX -0010-09-15T04:44:23 = XXXX 15 XXXXXXX mmss (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (yyyy/M) 2008-02-05T18:30:30 = 2008/2 1995-12-22T09:05:02 = 1995/12 -0010-09-15T04:44:23 = -010/9 yMEd (E yyyy/M/d) 2008-02-05T18:30:30 = XXXXXXX 2008/2/5 1995-12-22T09:05:02 = XXXX 1995/12/22 -0010-09-15T04:44:23 = XXXX -010/9/15 yMMM (MMM y) 2008-02-05T18:30:30 = XXXXXX 2008 1995-12-22T09:05:02 = XXXXXX 1995 -0010-09-15T04:44:23 = XXXXXXX -10 yMMMEd (E d MMM y) 2008-02-05T18:30:30 = XXXXXXX 5 XXXXXX 2008 1995-12-22T09:05:02 = XXXX 22 XXXXXX 1995 -0010-09-15T04:44:23 = XXXX 15 XXXXXXX -10 yMMMM (MMMM y) 2008-02-05T18:30:30 = XXXXXX 2008 1995-12-22T09:05:02 = XXXXXX 1995 -0010-09-15T04:44:23 = XXXXXXX -10 yQ (yyyy Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -010 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 XXXX 1995-12-22T09:05:02 = 1995 XXXX -0010-09-15T04:44:23 = -10 XXXX yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyM (yyyy/M) 2008-02-05T18:30:30 = 2008/2 1995-12-22T09:05:02 = 1995/12 -0010-09-15T04:44:23 = -010/9 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = XXXXXX 2008 1995-12-22T09:05:02 = XXXXXX 1995 -0010-09-15T04:44:23 = XXXXXXX -10 yyyyMMMMEEEEd (EEEE d MMMM y) 2008-02-05T18:30:30 = XXXXXXX 5 XXXXXX 2008 1995-12-22T09:05:02 = XXXX 22 XXXXXX 1995 -0010-09-15T04:44:23 = XXXX 15 XXXXXXX -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week XXXX SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.16.2 2013-08-25 DateTime::Locale::fa_IR(3)
All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy