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
vga_runinbackground(3)						Svgalib User Manual					    vga_runinbackground(3)

NAME
vga_runinbackground - enable running of the program while there is no VGA access SYNOPSIS
#include <vga.h> void vga_runinbackground(int stat); DESCRIPTION
Enable/disable background running of a graphics program. stat = 1 enables stat = 0 disables Normally, the program is suspended while not in the current virtual console. A program can only safely run in the background if it doesn't do any video access during this time. As of version 1.2.11 this was changed by Pekka T. Alaruikka <alaruik@cc.hut.fi> & Michael Friman <no email> The support for this must be enabled in Makefile.cfg of svgalib (which it is by default). Several ways to support this may exist internally. As of now, only one using proc-fs works. Using vga_runinbackground(VGA_GOTOBACK, void (*goto)()) and vga_runinbackground(VGA_COMEFROMBACK, void (*comefrom)()) with function pointers to functions void goto(void) and void comefrom(void) you can setup function to be called when your program goes to back- ground mode and when it comes back to foreground. These can be changed at any time, and passing NULL as function disables the feature. Both these new features require a vga_runinbackground_version(3) of 1 or higher. You should check and not call it when the svgalib in use returns 0. Also, when writing applications, check with #ifdef VGA_GOTOBACK /* code using vga_runinbackground(VGA_GOTOBACK, goto) */ #else /* code using no goto or comefrom function */ #endif if you are compiling with an svgalib that supports this feature, and try to rearrange your source to work without it when an svgalib ver- sion prior to 1.2.11 is used. The function should be called right after vga_init(3). The bg_test(6) demos shows the principle operation. Please note that background capabilities are in VERY early stages. Please do not expect that EVERYTHING works flawlessly when background abilities are enabled in your program. EXAMPLE
vga_init(); vga_setmode(G320x200x256); if (vga_runinbackground_version() == 1) vga_runinbackground(1); NOTES
Before a program is left background capable, it should be tested well. Most programs will work just well. When the program is in background, it can read IO-devices (except keyboard). This can cause harm, if the programmer does not take this int account. I.e. in games using a joystick or/and mouse device the game continues reading joystick or/and mouse as it would be on foreground. The mouse can be made working correctly also in background, but this means that svgalib must be configured to use gpm mouse driver. More information about gpm-linux can be founded from latest gpm packet (by Alessandro Rubini). The goto and comefrom routines provide a way to overcome this restriction. There are so far two different methods for background running. The first method use mmap function with FIXED option, which is not recom- mended by mmap's man page. It has some probability to fail. But it allows programs to think that graphics memory is always present. The second method is just let the functions to write directly graphics memory's save-buffer. This means that the memory area where graphics information is changes for the program. The program must always know where to write. This type of action needs much more work and leaves probably always room for race conditions. Hopefully the first method proves to be good enough and second method can be left away. Neither method allows the use of the graphics card's registers in background. When registers are used, vc switching is disabled, but the request are queued. Vc switching is done as soon as possible. Generally, accelerated functions will probably cause problems, except when they are implemented carefully to check for availability of the cards registers. User programs should generally not use the graphics registers directly. But if program needs to use the registers, it has to check if it is in background or not. In the background state it can not use the registers. For testing the vga_oktowrite(3) function can be used. During register access the virtual console must be locked. A possible code fragment might look like: vga_lockvc(); if (vga_oktowrite()) { /* Register operations. */ } else { /* Registers can not be used. Alternative action. */ } vga_unlockvc(); ADVANCED NOTES
Installation Background capability is enabled in svgalib by setting BACKGROUND=y and disabled by commenting #BACKGROUND=y in Makefile.cfg before compil- ing svgalib. Background capable svgalib is more stable with all programs. Programs do not have to use background abilities even when they are available. As of this writing, all precompiled svgalib binaries are background capable by default. NOTICE: proc-fs must be mounted for background capability. Status of the background feature Background capability in svgalib is in an early stagei of development. There has been done lot of work for it, but probably not everything will work perfectly. This applies only to programs which actually enabled background running with vga_runinbackground(3). The vga_drawline(3), vga_drawpixel(3), vga_getclolors(3), vga_getpixel(3), vga_screenoff(3), vga_screenon(3), vga_setegacolor(3), vga_setrgbcolor(3), vga_setcolor(3), vga_setpage(3) and vga_clear(3) functions appear to work and calling vga_setmode(3) is safe too but cannot change modes while in background. The remaining svgalib and vgagl function should work too but are not well tested. Calling accelerated functions will most probably cause harm though this is worked on. Please report problems to Pekka (see AUTHOR section). Programming within svgalib When coding within svgalib, there are same restrictions as in user programs. SVGA registers can not be used while in background. The svgalibrary has internal functions for locking and unlocking virtual console switching __svgalib_dont_switch_vt_yet() and __svgalib_is_vt_switching_needed(). These functions are not meant to be called from user program. vga_unlockvc(3) can not release vc switching if internal svgalib locking is used. This is for safety. The procedure for registers are similar to the procedure for user pro- grams: void vga_super_new_function(void) { __svgalib_dont_switch_vt_yet(); if (vga_oktowrite()) { /* Register operations. */ } else { /* Registers can not be used. Alternative action. */ } __svgalib_is_vt_switching_needed(); } SEE ALSO
svgalib(7), vgagl(7), libvga.config(5), bg_test(6), vga_accel(3), vga_bitblt(3), vga_blitwait(3), vga_fillblt(3), vga_hlinelistblt(3), vga_imageblt(3), vga_init(3), vga_lockvc(3), vga_oktowrite(3), vga_runinbackground_version(3), vga_safety_fork(3), vga_setchipset(3), vga_setpage(3), vga_setreadpage(3), vga_setwritepage(3), vga_unlockvc(3) AUTHOR
This manual page was edited by Michael Weller <eowmob@exp-math.uni-essen.de>. The function was implemented and documented by Pekka T. Alaruikka <alaruik@cc.hut.fi> & Michael Friman <no email>. Svgalib (>;= 1.2.11) 27 July 1997 vga_runinbackground(3)
All times are GMT -4. The time now is 01:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy