Sponsored Content
Top Forums Shell Programming and Scripting Need help in awk for multiple searches Post 302928784 by ashishagg2005 on Monday 15th of December 2014 08:41:08 AM
Old 12-15-2014
Need help in awk for multiple searches

I have a below file

RCS File name : abc.txt
Code:
something
something
....
symbolic names:
       implemented : 1.1

ssssssumthing

Revision 1.2
date : 12/12/12  author : abc

Revision 1.1
date : 11/11/11 author xyz

So now , in this file i have to first look for the implemented version just after the symbolic names and then for that particular revision , find the author of the same.

Since its a continuous stream , i am using the output to my awk command.

I have written the below code to get the revision number but could not get the second thing
Code:
<input stream> | awk '/symbolic names/{getline;var = $2} /"revision",var/{getline;var = $2}'

Please advise

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 12-15-2014 at 09:52 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep: do multiple searches?

I want to search the file /etc/passwd for all lines containing 'csh' but exlude all those lines that have '/usr' in them and dump the results into the file result. IMPORTANT: I need to do this in one command line. The following does not work: grep -v \(\/usr\) \(csh\) /etc/passwd >... (4 Replies)
Discussion started by: sdemba
4 Replies

2. News, Links, Events and Announcements

New Tool Searches and Replaces SCO Code

See this article: http://story.news.yahoo.com/news?tmpl=story&cid=74&ncid=738&e=9&u=/cmp/20030809/tc_cmp/13000487 (3 Replies)
Discussion started by: Neo
3 Replies

3. Shell Programming and Scripting

Creating searches?

Hello. Could do with some help on where to get started really. If anyone could help me it would be greatly appreciated. I have been working on this for a while now and I don't really know where to start but I am looking into creating a script that will process website hit files and output... (2 Replies)
Discussion started by: amatuer_lee_3
2 Replies

4. Shell Programming and Scripting

Perl syntax for sed searches

I am aware that Perl has a lot of features that originally came from sed and awk. I have a pattern that I am using like this: sed -n '/|Y|/p' I want to do the same thing in Perl and be able to either save that value in some kind of variable or array or potentially write it out to a file. ... (11 Replies)
Discussion started by: masinick
11 Replies

5. UNIX and Linux Applications

Alpine: LDAP searches hang

I just configured my ldap server in Alpine, but every search hangs indefinitely (or so it seems) and I have to end up killing Alpine and starting back up. The LDAP server runs over SSL on port 636, so I have specified port 636, but there doesn't seem to be an SSL option available so I turned on... (0 Replies)
Discussion started by: retrovertigo
0 Replies

6. Shell Programming and Scripting

How to delete corrupted characters and then do fuzzy searches?

Hi All I have a whole block of pages that have come in from various sources, unfortunately the pages in many instances have blocks of corrupted text. What I'm trying to do is write a sed line that will just delete non alphanumeric characters if they're in a block of say three or four... (5 Replies)
Discussion started by: Bashingaway
5 Replies

7. Shell Programming and Scripting

Nawk help searching for multiple lines and multiple searches

I use this command to find a search (Nr of active alarms are) and print one line before and 10 lines after the search keywords. nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=1 a=10 s="Nr of active alarms are:" *.log However, I would like to know how to tell it to print... (3 Replies)
Discussion started by: tthach830
3 Replies

8. UNIX for Dummies Questions & Answers

Output based on multiple searches

I have a file that looks like this: >Sample 539 GCCCAGCGCGCGILTGCCGCCGTCTCCGCCTGTCJOHNCCGCCATTGCCCCCGGTTAC I am using the following code to search specific patterns: awk '/^>/ { print $0 } NR==2 {if (/GIL/) { print "\t" "1" } else { print "\t" "0" }} NR==2 {if (/JOHN/) { print "\t""\t"... (7 Replies)
Discussion started by: Xterra
7 Replies

9. Shell Programming and Scripting

Customized text searches by using grep

I tried to ease text searches so made a customized grep: g () { if then i= for s in $2 do i="$i --include=*.$s" done else i='--include=*.txt --include=*.ini --include=*.*sh --include=*.c* --include=*.h --include=*.js --include=*.reg' fi grep -P -e \'$1\' -r "$i" } but I... (3 Replies)
Discussion started by: abdulbadii
3 Replies
IDENT(1)						      General Commands Manual							  IDENT(1)

NAME
ident - identify RCS keyword strings in files SYNOPSIS
ident [ -q ] [ -V ] [ file ... ] DESCRIPTION
ident searches for all instances of the pattern $keyword: text $ in the named files or, if no files are named, the standard input. These patterns are normally inserted automatically by the RCS command co(1), but can also be inserted manually. The option -q suppresses the warning given if there are no patterns in a file. The option -V prints ident's version number. ident works on text files as well as object files and dumps. For example, if the C program in f.c contains #include <stdio.h> static char const rcsid[] = "$Id: f.c,v 5.4 1993/11/09 17:40:15 eggert Exp $"; int main() { return printf("%s ", rcsid) == EOF; } and f.c is compiled into f.o, then the command ident f.c f.o will output f.c: $Id: f.c,v 5.4 1993/11/09 17:40:15 eggert Exp $ f.o: $Id: f.c,v 5.4 1993/11/09 17:40:15 eggert Exp $ If a C program defines a string like rcsid above but does not use it, lint(1) may complain, and some C compilers will optimize away the string. The most reliable solution is to have the program use the rcsid string, as shown in the example above. ident finds all instances of the $keyword: text $ pattern, even if keyword is not actually an RCS-supported keyword. This gives you infor- mation about nonstandard keywords like $XConsortium$. KEYWORDS
Here is the list of keywords currently maintained by co(1). All times are given in Coordinated Universal Time (UTC, sometimes called GMT) by default, but if the files were checked out with co's -zzone option, times are given with a numeric time zone indication appended. $Author$ The login name of the user who checked in the revision. $Date$ The date and time the revision was checked in. $Header$ A standard header containing the full pathname of the RCS file, the revision number, the date and time, the author, the state, and the locker (if locked). $Id$ Same as $Header$, except that the RCS filename is without a path. $Locker$ The login name of the user who locked the revision (empty if not locked). $Log$ The log message supplied during checkin. For ident's purposes, this is equivalent to $RCSfile$. $Name$ The symbolic name used to check out the revision, if any. $RCSfile$ The name of the RCS file without a path. $Revision$ The revision number assigned to the revision. $Source$ The full pathname of the RCS file. $State$ The state assigned to the revision with the -s option of rcs(1) or ci(1). co(1) represents the following characters in keyword values by escape sequences to keep keyword strings well-formed. char escape sequence tab newline space 40 $ 44 \ IDENTIFICATION
Author: Walter F. Tichy. Manual Page Revision: 5.4; Release Date: 1993/11/09. Copyright (C) 1982, 1988, 1989 Walter F. Tichy. Copyright (C) 1990, 1992, 1993 Paul Eggert. SEE ALSO
ci(1), co(1), rcs(1), rcsdiff(1), rcsintro(1), rcsmerge(1), rlog(1), rcsfile(5) Walter F. Tichy, RCS--A System for Version Control, Software--Practice & Experience 15, 7 (July 1985), 637-654. GNU
1993/11/09 IDENT(1)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy