Sponsored Content
Full Discussion: Return alias with pattern
Top Forums UNIX for Dummies Questions & Answers Return alias with pattern Post 302935225 by RudiC on Friday 13th of February 2015 02:07:07 PM
Old 02-13-2015
Try this
Code:
awk     'FNR==NR        {T[$1]; next}
         FNR==1         {FILE++}
         FILE==1        {if ($1 in T) ID[$2]
                         next}
         $2 in ID &&
         $1 ~ "^" PAT    # {print; delete ID[$2]}
        ' PAT="ab"  list lookup lookup
ab1 1 
ab3 1
ab2 2
ab31 2

Remove the # before the last action to achieve an output like
Code:
ab3 1
ab2 2

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with pattern search and return

I would like to write a script which will read a file containing a list of filenames of the format as shown below : /usr/local/packages/runcmdlinetool /home/john.doe/sdfsdf/sdfsdfsd/sdfsdf/sdfsdfTemplates.xml /usr/local/bin/gtar... (4 Replies)
Discussion started by: inditopgun
4 Replies

2. UNIX for Dummies Questions & Answers

return previous line for pattern match

Hi, Need some idea on file processing, I have file like below, Processing al sources ... ...No value found : CHECK. Completed comparing all sources. Comparing schedulers... Processing al targets ... ...No value found : From above I need to extract the line where "No value... (4 Replies)
Discussion started by: braindrain
4 Replies

3. Shell Programming and Scripting

Perl help - Searching for a pattern and return the position

Hi, I need to search a file, in each line I need to check for occurance of '1' from a particular position through the next 32 bytes. If 1 is found, i need to return the position. Here is an example of the file and the output i need. Please help. I'm new to perl and unix. File: ... (1 Reply)
Discussion started by: gpaulose
1 Replies

4. UNIX for Dummies Questions & Answers

Search specific pattern in file and return number of occurence

Hi I want to search for a specific pattern in file Say ABC;HELLO_UNIX_WORLD;PQR ABC;HELLO_UNIX_WORLD_IS_NOT_ENOUGH;XYZ ABC;HELLO_UNIX_FORUM;LMN Pattern to search is : "HELLO_UNIX_*****" and not "HELLO_UNIX_***_***_" I mean after "HELLO_UNIX" there can only be one word.In this case... (2 Replies)
Discussion started by: dashing201
2 Replies

5. Shell Programming and Scripting

How to add a return after a special pattern?

Hello I'm new to Solaris I have a file have things like these PATTERN12345678 PATTERN12345678PATTERN87654321 PATTERN12345678 PATTERN87654321 i hope i could change to this format PATTERN12345678 PATTERN12345678 PATTERN87654321 PATTERN12345678 PATTERN87654321 (4 Replies)
Discussion started by: beterhans
4 Replies

6. Solaris

Grep command to return all the lines from one matched pattern to another.

For example a log file looks like below- 13:30:00- abcdefghijklhjghjghjhskj. abcdefghijkl. 14:15:00- abcdefghijkl. 14:30:00- abcdefghijkl. 14:35:00- abcdefghijkl. 123456789. 123456789. 14:45:00- abcdefghijkl. (0 Replies)
Discussion started by: dev_shivv
0 Replies

7. Shell Programming and Scripting

Grep command to return all the lines between one matched pattern to another.

14:15:00- abcdefghijkl. 14:30:00- abcdefghijkl. 14:35:00- abcdefghijkl. 123456789. 123456789. 14:45:00- abcdefghijkl. 14:50:00- abcdefghijkl. 123456789. 15:30:00-abcdefghijkl. (3 Replies)
Discussion started by: dev_shivv
3 Replies

8. Shell Programming and Scripting

Suppressing carriage return in bash alias

I'd like to create an alias that displays my string but leaves my cursor at the end. Not seeing any examples of this. One indirect way might be to preload or stuff the history buffer, so I just hit up arrow. (2 Replies)
Discussion started by: tns1
2 Replies

9. Shell Programming and Scripting

bash: need to have egrep to return a text string if the search pattern has NOT been found

Hello all, after spending hours of searching the web I decided to create an account here. This is my first post and I hope one of the experts can help. I need to resolve a grep / sed / xargs / awk problem. My input file is just like this: ----------------------------------... (6 Replies)
Discussion started by: bash4ever
6 Replies

10. Shell Programming and Scripting

Pattern match exclusive return pattern/variable

I have an application(Minecraft Server) that generates a logfile live. Using Crontab and screen I send a 'list' command every minute. Sample Log view: 2013-06-07 19:14:37 <Willrocksyea1> hello* 2013-06-07 19:14:41 <Gromden29> hey 2013-06-07 19:14:42 Gromden29 lost connection:... (1 Reply)
Discussion started by: gatekeeper258
1 Replies
RDF::Query::Algebra::Aggregate(3pm)			User Contributed Perl Documentation		       RDF::Query::Algebra::Aggregate(3pm)

NAME
RDF::Query::Algebra::Aggregate - Algebra class for aggregate patterns VERSION
This document describes RDF::Query::Algebra::Aggregate version 2.908. METHODS
Beyond the methods documented below, this class inherits methods from the RDF::Query::Algebra class. "new ( $pattern, @groupby, $alias =" [$op => $col] )> "new ( $pattern, @groupby, expressions =" [ $alias => [$op, \%options, @cols] ] )> Returns a new Aggregate structure. Groups by the named bindings in @groupby, and returns new bindings for the named $alias for the operation $op on column $col. $op may be one of: COUNT, MIN, MAX, SUM. "construct_args" Returns a list of arguments that, passed to this class' constructor, will produce a clone of this algebra pattern. "pattern" Returns the aggregates pattern. "groupby" Returns the aggregate's GROUP BY binding names. "ops" Returns a list of tuples as ARRAY refs containing "$alias, $op, @cols". "sse" Returns the SSE string for this algebra expression. "as_sparql" Returns the SPARQL string for this algebra expression. "as_hash" Returns the query as a nested set of plain data structures (no objects). "type" Returns the type of this algebra expression. "referenced_variables" Returns a list of the variable names used in this algebra expression. "potentially_bound" Returns a list of the variable names used in this algebra expression that will bind values during execution. "definite_variables" Returns a list of the variable names that will be bound after evaluating this algebra expression. AUTHOR
Gregory Todd Williams <gwilliams@cpan.org> perl v5.14.2 2012-01-31 RDF::Query::Algebra::Aggregate(3pm)
All times are GMT -4. The time now is 05:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy