Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help required on printing the line if third field is not a empty space Post 302342729 by krao on Monday 10th of August 2009 02:21:40 PM
Old 08-10-2009
Hi malcomex999,

When i executed awk 'NF>2' inputfile . i am getting ouput file same as input file. It is not working for my requirement.


INPUT FILE[/B]

dcdccghjrry0yd cont
dcdccttrk820529 cont rdekedfsSCr
dcdccttrdky2d0y cont rdekedfsSC2
dcdccghtd228e9y cont 2ekert5fr
dcdccght0er9r0d incont
dcdccght5dk9rre cont
dcdccttrdky200k incont rdekedfsSC2

OUTPUT FILE

dcdccghjrry0yd cont
dcdccttrk820529 cont rdekedfsSCr
dcdccttrdky2d0y cont rdekedfsSC2
dcdccghtd228e9y cont 2ekert5fr
dcdccght0er9r0d incont
dcdccght5dk9rre cont
dcdccttrdky200k incont rdekedfsSC2
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

printing an empty line in a file (perl)

I know this must be really easy, but i can't get it to work I've got a perl script, with a file. I want to print an empty line, and the following doesn't seem to work: print nameoffile "\n" thanks for your help!! (3 Replies)
Discussion started by: kfad
3 Replies

2. Shell Programming and Scripting

How to print empty line when the a field is changed

Hi all, I have this input file .. BSS01 107 Swafieh 11/06/2008 12:06:57 BSS01 111 Ramada_Hotel 12/06/2008 11:37:20 BSS01 147 Kalha_Rep 11/06/2008 19:13:39 BSS01 147 Kalha_Rep ... (9 Replies)
Discussion started by: yahyaaa
9 Replies

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

4. Programming

Why is required to leave an empty line at the end of a C program?

I know it looks like a stupid question, but i really wanna know the reason. Actually, i think it's because the c compiler will detect it as the end of file "EOF" of the program, but, am i wrong? because it compiles it anyway, but keep showing warnings like "no new line at the end of file". I... (8 Replies)
Discussion started by: semash!
8 Replies

5. Shell Programming and Scripting

Help finding a field value then printing line

Hello, I'm trying to only print out the file systems that are greater than 90% full. So far I've got: df -k >sawky8 cat sawky8 | grep -v Filesystem | sed "s/%//g;" >sawky9 cat sawky9 | awk '{print $4}' | read stot print $stot if ;then echo $LINE Problem is it stops after the first... (2 Replies)
Discussion started by: Grueben
2 Replies

6. Shell Programming and Scripting

Printing empty subdirs before delete

I am using following code to delete all the empty sub dirs from the inputted dir $1. Before deleting empty dirs, I want to print those dirs which are going to be deleted. Can this be done with little modification in following code #!/bin/sh if ; then echo "Searching '$1' dir for empty... (16 Replies)
Discussion started by: ajaypatil_am
16 Replies

7. Shell Programming and Scripting

Printing uniq first field with the the highest second field

Hi All, I am searching for a script which will produce an output file with the uniq first field with the second field having highest value among all the duplicates.. The output file will produce only the uniqs which are duplicate 3 times.. Input file X 9 B 5 A 1 Z 9 T 4 C 9 A 4... (13 Replies)
Discussion started by: ailnilanjan
13 Replies

8. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

9. UNIX for Dummies Questions & Answers

Using awk to remove duplicate line if field is empty

Hi all, I've got a file that has 12 fields. I've merged 2 files and there will be some duplicates in the following: FILE: 1. ABC, 12345, TEST1, BILLING, GV, 20/10/2012, C, 8, 100, AA, TT, 100 2. ABC, 12345, TEST1, BILLING, GV, 20/10/2012, C, 8, 100, AA, TT, (EMPTY) 3. CDC, 54321, TEST3,... (4 Replies)
Discussion started by: tugar
4 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
Layout::Manager::Flow(3pm)				User Contributed Perl Documentation				Layout::Manager::Flow(3pm)

NAME
Layout::Manager::Flow - Directional layout manager DESCRIPTION
Layout::Manager::Flow is a layout manager that anchors components in one of the four cardinal directions. When you instantiate a Flow manager, you may supply it with an anchor value which may be one of north, south, east or west. The example below shows how the default anchor value of north works when you add two components. north +--------------------------------+ | component 1 | +--------------------------------+ | component 2 | +--------------------------------+ | | | | | | +--------------------------------+ Components are placed in the order they are added. If two items are added with a 'north' anchor then the first item will be rendered above the second. Components will be expanded to take up all space perpendicular to their anchor. North and south will expand widths while east and west will expand heights. Flow is similar to Java's FlowLayout <http://java.sun.com/docs/books/tutorial/uiswing/layout/flow.html>. It does not, however, center components. This features may be added in the future if they are needed. SYNOPSIS
$cont->add_component($comp1); $cont->add_component($comp2); my $lm = Layout::Manager::Flow->new(anchor => 'north'); $lm->do_layout($cont); ATTRIBUTES
anchor The direction this manager is anchored. Valid values are north, south, east and west. used Returns the amount of space used an arrayref in the form of "[ $width, $height ]". wrap If set to a true value, then component will be 'wrapped' when they do not fit. This currently only works for East and West anchored layouts. METHODS
do_layout Size and position the components in this layout. AUTHOR
Cory Watson, "<gphat@cpan.org>" COPYRIGHT &; LICENSE Copyright 2008 by Cory G Watson This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2011-05-16 Layout::Manager::Flow(3pm)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy