Sponsored Content
Top Forums UNIX for Dummies Questions & Answers awk -remove pattern from file Post 302964771 by RudiC on Tuesday 19th of January 2016 03:35:11 AM
Old 01-19-2016
Not sure I understood the request entirely and correctly, but try
Code:
awk '$4 == "1997" {if ($3 == 2015) {$3=""; sub (FS FS, FS)}; print}' file
Nov 05 1997 /ifs/inventory2/
Nov 05 1997 /ifs/inventory8/
Nov 05 1997 /ifs/inventory7/
Nov 05 1997 /ifs/inventory6/
Nov 05 1997 /ifs/inventory5/

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need an awk / sed / or perl one-liner to remove last 4 characters with non-unique pattern.

Hi, I'm writing a ksh script and trying to use an awk / sed / or perl one-liner to remove the last 4 characters of a line in a file if it begins with a period. Here is the contents of the file... the column in which I want to remove the last 4 characters is the last column. ($6 in awk). I've... (10 Replies)
Discussion started by: right_coaster
10 Replies

2. Shell Programming and Scripting

awk delete/remove rest of line on multiple search pattern

Need to remove rest of line after the equals sign on search pattern from the searchfile. Can anybody help. Couldn't find any similar example in the forum: infile: 64_1535: Delm. = 86 var, aaga 64_1535: Fran. = 57 ex. ccc 64_1639: Feb. = 26 (link). def 64_1817: mar. = 3/4. drz ... (7 Replies)
Discussion started by: sdf
7 Replies

3. Shell Programming and Scripting

Awk-sed help : to remove first and last line with pattern match:

awk , sed Experts, I want to remove first and last line after pattern match "vg" : I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data. - So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Discussion started by: rveri
5 Replies

4. Shell Programming and Scripting

awk to search for pattern and remove line

I am an awk beginner and need help figuring out how to search for a number in the first column and if it (or anything greater) exists, remove those lines. AM11400012012 2.26 2.12 1.98 2.52 3.53 3.01 3.62 5.00 3.65 7.95 0.79 3.88 0.00 AM11400012013 3.39 2.29 ... (1 Reply)
Discussion started by: ncwxpanther
1 Replies

5. Shell Programming and Scripting

Awk; pattern match, remove and re write

the following pattern match works correctly for me awk '/name="Fruits"/{f=1;next} /"name=Vegetables"/{f=0} f' filename This works well for me. Id like to temporarily move the match out of the file ( > newfile) and be able to stick it back in the same place at a later time. Is this... (7 Replies)
Discussion started by: TY718
7 Replies

6. Shell Programming and Scripting

Big pattern file matching within another pattern file in awk or shell

Hi I need to do a patten match between files . I am new to shell scripting and have come up with this so far. It take 50 seconds to process files of 2mb size . I need to tune this code as file size will be around 50mb and need to save time. Main issue is that I need to search the pattern from... (2 Replies)
Discussion started by: nitin_daharwal
2 Replies

7. Shell Programming and Scripting

awk remove/grab lines from file with pattern from other file

Sorry for the weird title but i have the following problem. We have several files which have between 10000 and about 500000 lines in them. From these files we want to remove lines which contain a pattern which is located in another file (around 20000 lines, all EAN codes). We also want to get... (28 Replies)
Discussion started by: SDohmen
28 Replies

8. Shell Programming and Scripting

awk to remove mutiple values from specific pattern, leaving a single value

In the awk below I am trying to remove all instances after a ; (semi-colon) or , (comma) in the ANN= pattern. I am using gsub to substitute an empty string in these, so that ANN= is a single value (with only one value in it the one right after the ANN=). Thank you :). I have comented my awk and... (11 Replies)
Discussion started by: cmccabe
11 Replies

9. UNIX for Beginners Questions & Answers

awk to remove pattern and lines above pattern

In the awk below I am trying to remove all lines above and including the pattern Test or Test2. Each block is seperated by a newline and Test2 also appears in the lines to keep but it will always have additional text after it. The Test to remove will not. The awk executed until the || was added... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies
rrpc_inq_interfaces(3ncs)												 rrpc_inq_interfaces(3ncs)

Name
       rrpc_inq_interfaces - obtain a list of the interfaces that a server exports

Syntax
       #include <idl/c/rrpc.h>

       void rrpc_$inq_interfaces(handle, max_ifs, ifs, l_if, status)
       handle_t handle;
       unsigned long max_ifs;
       rrpc_$interface_vec_t ifs[];
       unsigned long *l_if;
       status_$t *status;

Arguments
       handle	      An RPC handle.

       max_ifs	      The maximum number of elements in the array of interface specifiers.

       ifs	      An array of rpc_$if_spec_t.

       l_if	      The index of the last element in the returned array.

       status	      The  completion status.  If the completion status returned in is equal to status_$ok , then the routine that supplied it was
		      successful.

Description
       The routine returns an array of RPC interface specifiers.

Restrictions
       On the client side, because of the way the calls are defined and implemented in the run-time library you  must  explicitly  call  into  the
       entry point vector table for the interface to send an request across the network. The following is an example of a call that works
	 (*rrpc_$client_epv.rrpc_$inq_interfaces)(handle,
		    (unsigned long) max_ifs, ifs, &l_if, &status);
       The server side stub routines call the entry point on behalf of the client.  The results of the call are then passed back to the client.

Files
See Also
       intro(3ncs)

															 rrpc_inq_interfaces(3ncs)
All times are GMT -4. The time now is 08:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy