Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using awk to remove duplicate line if field is empty Post 302931846 by tugar on Friday 16th of January 2015 12:13:47 AM
Old 01-16-2015
Worked flawlessly!

Thank you Ravinder.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk scrip to remove empty field

Hi I have a file which looks like this name: Sally group: Group4 name: Tim group: Group1 name: Dan group: Group2 name: Chris group: Group3 name: Peter group: name: Fred group: name: Mary group: Group2 Well I want to get rid of the... (4 Replies)
Discussion started by: bombcan
4 Replies

2. Shell Programming and Scripting

awk script to remove duplicate rows in line

i have the long file more than one ns and www and mx in the line like . i need the first ns record and first www and first mx from line . the records are seperated with tthe ; i am try ing in awk scripting not getiing the solution. ... (4 Replies)
Discussion started by: kiranmosarla
4 Replies

3. Shell Programming and Scripting

Using sed to remove lines where field is empty

I was just looking at this post: https://www.unix.com/shell-programming-scripting/22893-delete-multiple-empty-lines.html. and I am looking to achieve the same with sed. So the idea is to delete lines from a file where a certain field has no value. Inputfile: EMID MMDDYY HOURS JOB EMNAME 0241... (4 Replies)
Discussion started by: figaro
4 Replies

4. Shell Programming and Scripting

awk - if field is empty, move line to new file

I have a script with this statement: /usr/xpg4/bin/awk -F"" 'NR==FNR{s=$2;next}{printf "%s\"%s\"\n", $0, s}' LOOKUP.TXT finallistnew.txt >test.txt I want to include logic or an additional step that says if there is no data in field 3, move the whole line out of test.txt into an additional... (9 Replies)
Discussion started by: scriptr2be
9 Replies

5. Shell Programming and Scripting

Remove duplicate lines (the first matching line by field criteria)

Hello to all, I have this file 2002 1 23 0 0 2435.60 131.70 5.60 20.99 0.89 0.00 285.80 2303.90 2002 1 23 15 0 2436.60 132.90 6.45 21.19 1.03 0.00 285.80 2303.70 2002 1 23 ... (6 Replies)
Discussion started by: joggdial3000
6 Replies

6. Shell Programming and Scripting

awk - remove row if specific field is empty/blank

I have this text.filecharles darwin sam delight george washington johnson culper darwin sam delight micheal jackson penny lite and would like to remove the row, if the first field is blank. so the result would be: result.filecharles darwin sam ... (4 Replies)
Discussion started by: charles33
4 Replies

7. UNIX for Dummies Questions & Answers

remove empty field

Hi all ! I'm sure it is a basic question but I didn't find any threads that fit my need. How to remove empty fields with awk? Or in other words, how to shift all the fields after an empty field on the left? input: 1|2||3|4|5||6 wanted: 1|2|3|4|5|6 I tried: awk '{for(i=1; i<=NF;... (7 Replies)
Discussion started by: lucasvs
7 Replies

8. Shell Programming and Scripting

Remove duplicate value based on two field $4 and $5

Hi All, i have input file like below... CA009156;20091003;M;AWBKCA72;123;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;; CA009156;20091003;M;AWBKCA72;321;;CANADIAN WESTERN BANK;EDMONTON;;2300, 10303, JASPER AVENUE;;T5J 3X6;; CA009156;20091003;M;AWBKCA72;231;;CANADIAN... (2 Replies)
Discussion started by: mohan sharma
2 Replies

9. Shell Programming and Scripting

How to remove empty field in a text file?

Hi all, I want to remove empty field in a text file. I tried to used sed. But it failed. Input: LG10_PM_map_19_LEnd 1000560 G AG AG LG10_PM_map_19_LEnd 1005621 G AG LG10_PM_map_19_LEnd 1011214 A AG AG LG10_PM_map_19_LEnd 1011673 T CT CT ... (3 Replies)
Discussion started by: huiyee1
3 Replies

10. Shell Programming and Scripting

awk to remove line if field has symbols in it

Trying to use awk to remove a line only if $1 contains either ; or :. Thje awk below runs but no lines are removed. Thank you :). awk awk '$1 !~ /;/ || $1 !~ /:/ { print }' file file AARS2;TMEM151B 1 AASS 2 ABAT 3 ABCA1 3 ABCA10 1 ABCA12 2 ABCA13 1 ABCA13:AX746840 2 ABCA2 5 (5 Replies)
Discussion started by: cmccabe
5 Replies
acucntrl(8)						      System Manager's Manual						       acucntrl(8)

NAME
acucntrl - turn around tty line between dialin and dialout SYNOPSIS
/usr/libexec/acucntrl keyword ttyline DESCRIPTION
Acucntrl turns around terminal line, enabling it to be used for both dialin and dialout. On dialin a terminal line is assumed to have modem control enabled and a getty process in existence waiting for logins. On dialout modem control is disabled and there is no getty process. This program must be run setuid to root. keyword is chosen from the list: disable or dialout, to condition a line for dialout; and enable or dialin, to condition a line for dialin. When the line is conditioned for dialing out, the login name of the real uid of the process is placed in /var/run/utmp in capitals. This declares that the line is in use and acts as an additional locking mechanism. Acucntrl will refuse to act if the /var/run/utmp entry for the line is not null, is not the the user's login name (capitalized or not), and if the process is not running as the superuser. The last condition is to allow the superuser to clear the state of the line. Turning modem control on or off is handled by poking into /dev/kmem. It is currently implemented for dz, dh, and dmf lines. Under 4.2 BSD the program will also refuse to disable a line if carrier is sensed on it. This is to avoid the dead period where someone has just dialed in and made the connection but has not yet logged in. Ttyline can be either of the form tty* or /dev/tty*. Enabling/disabling a line whose name does not begin with ttyd? is prohibited unless the real uid of the process is 0 or if the login name corresponding to the real uid is uucp. This is a security precaution. Steps taken when disabling (i.e. setup for dialing out) 1) check input arguments 2) look in /var/run/utmp to check that the line is not in use by another user 3) disable modem control on line 4) check for carrier on device 5) change owner of device to real uid 6) edit /etc/ttys, changing the first character of the appropriate line to 0 7) send a hangup to process 1 to poke init to disable getty 8) post uid name in capitals in /var/run/utmp to let world know device has been grabbed 9) make sure that DTR is on Steps taken when enabling (i.e. setup for dialin) 1) check input arguments 2) look in /var/run/utmp to check that the line is not in use by another user 3) make sure modem control on line is disabled 4) turn off DTR to make sure line is hung up 5) condition line: clear exclusive use and set hangup on close modes 6) turn on modem control 7) edit /etc/ttys, changing the first character of the appropriate line to 1 8) send a hangup to process 1 to poke init to enable getty 9) clear uid name for /var/run/utmp HISTORY
First written by Allan Wilkes (fisher!allan) Modified June 8,1983 by W.Sebok (astrovax!wls) to poke the kernel rather than use a kernel hack to turn on/off modem control, using a sub- routine stolen from a program written by Tsutomu Shimomura {astrovax,escher}!tsutomu Worked over many times by W.Sebok (i.e. hacked to death) FILES
/dev/kmem, /vmunix, /etc/ttys, /var/run/utmp, /dev/tty* BUGS
Sensing carrier requires the 4.2 BSD TIOCMGET ioctl call. Unfortunately this ioctl is not implemented in the vanilla 4.2 BSD dh driver even though the dz and dmf drivers use an emulation of the DH11's modem control bits. This has been fixed here. Some time (currently 2 seconds) is required between disabling modem control and opening the device. This is probably because of a race with getty whose open is finally being allowed to complete. This time interval may not be enough on a loaded system. Because of this problem and the above problem with the dh driver there is deliberately no error message given when the TIOCMGET ioctl fails. Previously there was similar synchronization problem with the init process. When dialins are disabled the capitalized name of the process cannot be posted into /var/run/utmp until init has finished clearing /var/run/utmp. However one does not know how long that will take, and, on a loaded system, it can take quite a while. This was solved by the strategy of 1) posting the name, 2) poking init, 3) going into a loop where the process repeatedly waits a second and checks whether the entry has been cleared from /var/run/utmp, and 4) posting the name again. 4.3 Berkeley Distribution November 27, 1996 acucntrl(8)
All times are GMT -4. The time now is 03:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy