Sponsored Content
Top Forums Shell Programming and Scripting Remove bracket part entires and separate entries after comma Post 302731469 by Priyanka Chopra on Thursday 15th of November 2012 06:04:33 AM
Old 11-15-2012
Hi

Kindly find attached file which describes about comma in first column and semicolon in second column

I have tried to remove brackets but wasnt abel to remove entries and not at all done with comma and semicolon separation

Code:
awk -v p="[()]" '{
for(i=1;i<=NF;i++)
 if(gsub(p,"",$i))
  if(++a[$i]>1) 
   $i=""
for(i in a)
 delete a[i]
}1' infile


Last edited by Scrutinizer; 11-15-2012 at 07:15 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

count data separate by comma

hi experts, i have some problem with count data which separate by comma, below sample data : 01,011222823b6d,011222823f29,0028a5,002993,6212345678, 659111111111,6598204507,6281105008,6596197849,_,525016160836958,_, ffffffff,000000000000000000000000,_,_,_,fd,fd,ff,00,1,0028a5-002993,_,... (10 Replies)
Discussion started by: bucci
10 Replies

2. Solaris

How to remove setfacl entires for a file

I gave the permission for a user using Setfacl as folllows setfacl -m u:user:rwx,m:rwx /home/master To a home path of a master user When i try to remove the same it showing as $ setfacl -r s /home/master usage: setfacl -f aclfile file ... setfacl -d... (2 Replies)
Discussion started by: GIC1986
2 Replies

3. Shell Programming and Scripting

using diff to on two file but ignoring the last comma separate value

Hi guys I have two file which I sdiff. ie file 1: AA,12,34,56,,789,101,,6666 file 2: AA,12,34,56,,789,101,,7777 The last comma separated value will always change from one day to the next. Is there another unix utility I can use that will sdiff two files but ignore the last comma... (1 Reply)
Discussion started by: wny201
1 Replies

4. Shell Programming and Scripting

ksh, difference between double bracket and single bracket

Can somebody tell me the difference between double brackets and single brackets, when doing a test. I have always been acustomed to using single brackets and have not encountered any issues to date. Why would somebody use double brackets. Ie if ] vs if Thanks to... (2 Replies)
Discussion started by: BeefStu
2 Replies

5. Shell Programming and Scripting

Remove bracket part

Hi I have to remove in a file in first column whatever is written in brackets with brackets so one file hgfd 123 gfhdj 483 jdgfdg 34738 the output shuld be hgfd 123 gfhdj 483 jdgfdg 34738 (9 Replies)
Discussion started by: manigrover
9 Replies

6. Shell Programming and Scripting

Separate Entries after comma

Hi All I need help to separate entries after commas in my I have 2 columns in my file like this Ramush, Shyam, Mohan First Ram, Mohan, Kaavya Second, Fourth Kavi, Ram, Shaym, Mohan Third I ahve to separate entries after comma in a separate row... (9 Replies)
Discussion started by: kareena
9 Replies

7. UNIX for Advanced & Expert Users

Comma separate issue in UNIX

In awk the field seprator is not working properly, I am trying to cut the fields from the file based on the delimiter example comma (,) awk -F, "{print {$1 FS $3 FS $5 FS FS $2}}" Sample.csv But i am not getting desired output can anyone help me how to check real ascii comma there in my... (9 Replies)
Discussion started by: rspwilliam
9 Replies

8. Shell Programming and Scripting

How to remove contents from file which are under bracket?

hello Friend, In hostgroup file, i have define lots of hostgroups. I need to remove few of them without manually editing file. Need script or syntax. I want to search particular on hostgroup_members and delete hostgoup defination of it. for example. define hostgroup{ hostgroup_name... (8 Replies)
Discussion started by: ghpradeep
8 Replies

9. Shell Programming and Scripting

Remove bracket including text inside with sed

Hello, I could not remove brackets with text contents myfile: Please remove the bracket with text I wish to remove: I tried: sed 's/\//' myfile It gives: Please remove the bracket with text A1 I expect: Please remove the bracket with text Many thanks Boris (2 Replies)
Discussion started by: baris35
2 Replies
SAMPLE1D(l)															       SAMPLE1D(l)

NAME
sample1d - Resampling of 1-D data sets SYNOPSIS
sample1d infile [ -Fl|a|c ] [ -H[nrec] ] [ -Ixinc ] [ -M[flag] ] [ -Nknotfile ] [ -Sxstart ] [ -Tx-col] [ -V ] [ -bi[s][n] ] [ -bo[s][n] ] DESCRIPTION
sample1d reads a multi-column ASCII [or binary] data set from file [or standard input] and resamples the timeseries/profile at locations where the user needs the values. The user must provide the column number of the independent (monotonically increasing or decreasing) vari- able. Equidistant or arbitrary sampling can be selected. All columns are resampled based on the new sampling interval. Several interpola- tion schemes are available. infile This is a multi-column ASCII [of binary, see -b] file with one column containing the independent variable (which must be monotoni- cally in/de-creasing) and the remaining columns holding misc. data values. If no file is provided, sample1d reads from standard input. OPTIONS
No space between the option flag and the associated arguments. -F Choose from l (Linear), a (Akima spline), and c (natural cubic spline) [Default is -Fa]. You may change the default interpolant; see INTERPOLANT in your .gmtdefaults file. -H Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults file. If used, GMT default is 1 header record. -I xinc defines the sampling interval. [Default is the separation between the first and second abcissa point in the infile] -M Multiple segment file. Segments are separated by a record whose first character is flag. [Default is '>']. -N knotfile is an optional ASCII file with the x locations where the data set will be resampled in the first column -S For equidistant sampling, xstart indicates the location of the first output value. [Default is the smallest even multiple of xinc inside the range of infile] -T Sets the column number of the independent variable [Default is 0 (first)]. -V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. -bi Selects binary input. Append s for single precision [Default is double]. Append n for the number of columns in the binary file(s). [Default is 2 (or at least the number of columns implied by -T]. -bo Selects binary output. Append s for single precision [Default is double]. EXAMPLES
To resample the file profiles.tdgmb, which contains (time,distance,gravity,magnetics,bathymetry) records, at 1km equidistant intervals using Akima's spline, try' sample1d profiles.tdgmb -I1 -Fa -T1 > profiles_equi_d.tdgmb To resample the file depths.dt at positions listed in the file grav_pos.dg, using a cubic spline for the interpolation, try sample1d depths.dt -Ngrav_pos.dg -Fc > new_depths.dt SEE ALSO
gmt(1gmt), filter1d(1gmt) 1 Jan 2004 SAMPLE1D(l)
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy