Need to remove columns from file at run time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to remove columns from file at run time
# 15  
Old 10-16-2015
Another approach:
Code:
awk -F, '{print NF==2?$1:$1","$3}' file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove blank columns from a tab delimited text file

Hello, I have some tab delimited files that may contain blank columns. I would like to delete the blank columns if they exist. There is no clear pattern for when a blank occurs. I was thinking of using sed to replace instances of double tab with blank, sed 's/\t\t//g' All of the examples... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

2. Shell Programming and Scripting

Remove Duplicates on multiple Key Columns and get the Latest Record from Date/Time Column

Hi Experts , we have a CDC file where we need to get the latest record of the Key columns Key Columns will be CDC_FLAG and SRC_PMTN_I and fetch the latest record from the CDC_PRCS_TS Can we do it with a single awk command. Please help.... (3 Replies)
Discussion started by: vijaykodukula
3 Replies

3. Shell Programming and Scripting

Remove few columns from pipe delimited file

I have file as below column1|column2|column3|column4|column5| fill1|fill2|fill3|fill4|fill5| abc1|abc2|abc3|abc4|abc5| . . . . i need to remove column2,3, from that file column1|column4|column5| fill1|fill4|fill5| abc1|abc4|abc5| . . . (3 Replies)
Discussion started by: greenworld123
3 Replies

4. Shell Programming and Scripting

How to take the file name in run time using shell.?

I want to take the file name as an input to the program and copy that file into new location using shell. Below program is not working properly. #!/bin/sh if ; then `/usr/bin/perl -pi -e's/(notifications_enabled\s*)(\d+)/$sub = "$1" . ("$2"== "0" ? "1":"0")/e; ' $file` `cp... (2 Replies)
Discussion started by: praveen265
2 Replies

5. Shell Programming and Scripting

remove white space from specific columns in text file

Hello i have a text file like this: 1 AB AC AD EE 2 WE TR YT WW 3 AS UY RF YT the file is bigger , but that's an example of the data what i want to do is to merge all columns together except the first one, it will become like this : 1 ABACADEE 2 WETRYTWW 3 ASUYRFYT (8 Replies)
Discussion started by: shelladdict
8 Replies

6. Shell Programming and Scripting

Remove duplicate columns in input file

hello, I have an input file which looks like this: 2 C:G 17 -0.14 8.75 33.35 3 G:C 16 -2.28 0.98 28.22 4 C:G 15 0.39 11.06 29.31 5 G:C 14 2.64 5.17 36.07 6 G:C 13 -0.65 2.05 21.94 7 C:G 11 138.96 21.64 14.40 9 C:G 27 -2.40 6.95 27.98 10 C:G 26 2.89 15.60 34.33 11 G:C... (7 Replies)
Discussion started by: linux_usr
7 Replies

7. Shell Programming and Scripting

Search based on 1,2,4,5 columns and remove duplicates in the same file.

Hi, I am unable to search the duplicates in a file based on the 1st,2nd,4th,5th columns in a file and also remove the duplicates in the same file. Source filename: Filename.csv "1","ccc","information","5000","temp","concept","new" "1","ddd","information","6000","temp","concept","new"... (2 Replies)
Discussion started by: onesuri
2 Replies

8. Shell Programming and Scripting

Single command for add 2 columns and remove 2 columns in unix/performance tuning

Hi all, I have created a script which adding two columns and removing two columns for all files. Filename: Cust_information_1200_201010.txt Source Data: "1","Cust information","123","106001","street","1-203 high street" "1","Cust information","124","105001","street","1-203 high street" ... (0 Replies)
Discussion started by: onesuri
0 Replies

9. Shell Programming and Scripting

How to run this program with only one input file at a time

i have a program ABC, which runs every two minutes and takes the input according to the a value called "pointer" files need to be processed by ABC are input0001 input0002 input0003 input0004 input0005 current value of pointer is 0001, now program runs and takes all the files from... (2 Replies)
Discussion started by: Prat007
2 Replies

10. Shell Programming and Scripting

Remove lines, Sorted with Time based columns using AWK & SORT

Hi having a file as follows MediaErr.log 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:12:16 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:22:47 84 Server1 Policy1 Schedule1 master1 05/08/2008 03:41:26 84 Server1 Policy1 ... (1 Reply)
Discussion started by: karthikn7974
1 Replies
Login or Register to Ask a Question
UPDATE-EXIM4DEFAULTS(8) 				      System Manager's Manual					   UPDATE-EXIM4DEFAULTS(8)

NAME
update-exim4defaults - Manage exim4 daemon default file. SYNOPSIS
update-exim4defaults [ --qflags flags ] [ --queuerunner combined|queueonly|separate|ppp|no|nodaemon ] [ --queuetime time ] [ --commonop- tions options ] [ --queuerunneroptions options ] [ --smtplisteneroptions options ] [ --remove-common options ] [ --remove-queue options ] [ --remove-smtp options ] [ --force|-f ] [ --help|-h ] [ --init ] DESCRIPTION
update-exim4defaults allows one to set run parameters for the Exim daemon in /etc/default/exim4. Its main purpose is for interaction with packages enhancing Exim like virus-scanners that need to change the way the exim daemon is started. OPTIONS
--help|-h Print short usage instructions and exit. --qflags flags Set qflags, special flags given to exim directly after the "-q". See exim(8) for more information. --queuerunner combined|queueonly|separate|ppp|no|nodaemon Should the init script start one daemon that listens on the smtp port for incoming connections and runs the queue at regular inter- vals (combined) , or should it start two separate daemons, one listening on the smtp port, the other running the queue (separate) , or should the queue only be run by /etc/ppp/ip-up.d/exim4 (ppp) , or shouldn't we run the queue at all, for example if you'd rather do this with cron ? Or should we only start a queuerunner (queueonly) or no daemon at all (nodaemon) ? --queuetime time In which intervals should we run the queue? This passed as option -q<qflags>time to Exim, e.g. -q30m or -qq1h. --commonoptions options Options passed both to queue-running and listening instances of Exim. --queuerunneroptions options Options only passed to the instance of Exim running the queue. --smtplisteneroptions options Options only passed to the instance of Exim listening on the SMTP port. --force|-f Without this option update-exim4defaults exits with an error if at least one of the options --queuetime, --commonoptions, --queuerunneroptions or --smtplisteneroptions is used and the corresponding value in /etc/default/exim4 is already set to a nonempty value. --remove-common option Try to remove the given option from COMMONOPTIONS. --remove-queue option Try to remove the given option from QUEUERUNNEROPTIONS. --remove-smtp option Try to remove the given option from SMTPLISTENEROPTIONS. The --remove-commands cannot be used at the same time as any of --commonoptions, --queuerunneroptions or --smtplisteneroptions. The --remove-commands will additionally remove whitespace at the beginning and the end of the option and exchange multiple spaces wi a single one. --init create a default /etc/default/exim4 file and exit immediately. Unless --force was also specified update-exim4defaults exits (suc- cessfully) without doing anything if /etc/default/exim4 already exists. All other options are ignored. EXIT STATUS
0 change was successful or nothing needed to be done. 1 generic error: wrong options, unreadable configuration file, etc. 2 QUEUEINTERVAL was already set. 4 COMMONOPTIONS was already set. 8 QUEUERUNNEROPTIONS was already set. 16 SMTPLISTENEROPTIONS was already set. 32 QFLAGS was already set. 64 --remove-something failed, i.e. the value of the option was not changed. Exit codes 2 to 32 will be summed up, if more than one unsuccessful option was given. FILES
/etc/default/exim4 The configuration file. /etc/init.d/exim4 The Exim init-script. /etc/ppp/ip-up.d/exim4 The queuerunner in this file also uses COMMONOPTIONS and QUEUERUNNEROPTIONS and does not run if QUEUERUNNER=no. BUGS
This manual page needs a major re-work. If somebody knows better groff than us and has more experience in writing manual pages, any patches would be greatly appreciated. SEE ALSO
exim(8), /usr/share/doc/exim4-base/ AUTHOR
Andreas Metzler <ametzler at downhill.at.eu.org> EXIM4 March 26, 2003 UPDATE-EXIM4DEFAULTS(8)