Sponsored Content
Top Forums Shell Programming and Scripting Regex within IF statement in awk Post 302805949 by hanson44 on Saturday 11th of May 2013 09:19:26 PM
Old 05-11-2013
The pattern within /PAT/ cannot include variables. The spacebar fixed pattern is one solution. A more general solution, exactly the way you want it, is as follows:
Code:
PAT=X "(15|20|45|70)" Y; if (Z !~ PAT)

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Regex in if-then-else statement to match strings

hello I want to do a pattern match for string in the if statement, but I am not sure how to use regex inside the if statement. I am looking for something like this: if {2,3} ]; then ..... .... ... fi (7 Replies)
Discussion started by: rakeshou
7 Replies

2. Shell Programming and Scripting

awk or regex

Hi! I want to made a program that will generate code like this: {{Navedi XYZ |avtor=XYZ1 |naslov=XYZ2 |leto_izzida=XYZ3 |zalozba=XYZ4 |kraj=XYZ5 |isbn=XYZ6 |cobiss_id=XYZ7 }} from input like this: <b> ODGOVORNOST............. : <a... (5 Replies)
Discussion started by: smihael
5 Replies

3. Shell Programming and Scripting

[BASH] recognise new line regex in case statement

Hi, I'm trying to write a routine to parse a file that contains data that will be read into arrays. The file is composed of labels to identify data types and arbitrary lines of data with the usual remarks and empty new lines as is common with config files. The initial pass is built as so:... (3 Replies)
Discussion started by: ASGR
3 Replies

4. Shell Programming and Scripting

awk regex problem

hi everyone suppose my input file is ABC-12345 ABCD-12345 BCD-123456 i want to search the specific pattern which looks like - in a file so i used this command cat $file | awk ' { if ($0 ~ /-/) { print } }' so it gives me the result as ABCD-12345 BCD-12345 BCD-12345 ... (31 Replies)
Discussion started by: aishsimplesweet
31 Replies

5. UNIX for Dummies Questions & Answers

Using AWK and regex

Hi can you suggest in this regard The sample.txt conatins the data name lines type sam 12 txt sam 24 xls sam 36 pdf ram 32 txt ram 45 sxls ram 58 word sam 92 jpeg sam 21 gif sam 22 ltf from the data i need to sum all line... (5 Replies)
Discussion started by: krashraj
5 Replies

6. Shell Programming and Scripting

awk equivalent of regex

Hi all, Can someone tell me what's the (g)awk equal of this simple regex to find ip addresses in urls: egrep "^http://{1,3}\.{1,3}\.{1,3}\.{1,3}(:{1,5})?/"Input: http://10.0.0.1/query.exe http://11y10x09w:80/howaboutme http://192.168.100.190:1234/takeme.gpg Output:... (8 Replies)
Discussion started by: r4v3n
8 Replies

7. Shell Programming and Scripting

Regex escape special character in AWK if statement

I am having issues escaping special characters in my AWK script as follows: for id in `cat file` do grep $id in file2 | awk '\ BEGIN {var=""} \ { if ( /stringwith+'|'+'50'chars/ ) { echo "do this" } else if ( /anotherString/ ) { echo "do that" } else { ... (4 Replies)
Discussion started by: purebc
4 Replies

8. Shell Programming and Scripting

If statement with [[ ]] and regex not working as expected

Using BASH: $ if -- ::00" ]]; then echo "true"; else echo "false"; fi false Mike (5 Replies)
Discussion started by: Michael Stora
5 Replies

9. Shell Programming and Scripting

Perl - what does this statement mean -Regex

push @MACARRAY, "$+{catalog} $+{machine}\n" if ($info =~ /(?<catalog>catalog).+?(?<machine>\*+)/ms); I am (still) trying to solve problem. Looking around on the server I found this piece of code. Specifically what does "$+{catalog} $+{machine}\n" do ? Thanks in advance (1 Reply)
Discussion started by: popeye
1 Replies

10. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
LIBPAT(3)						     cao-vlsi reference manual							 LIBPAT(3)

ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr NAME
PAT - Generic pattern data structure DESCRIPTION
PAT is a generic data structure supporting vlsi concepts. It allows representation of a sequence of simulation patterns in a data struc- ture. The goal of PAT is to define an ad hoc single data structure (object), with well known fixed meaning for each concept manipulated in pat- tern description. So any tools that needs to access simulation patterns can be build upon it, using these structures. For each object (data structure), a set of functions has been defined in order to add, delete or access it. These functions are defined in a low-level library libPat106.a. Some other functions are higher level. They are defined in a high-level library libPhl106.a. There are also some parsers-drivers. A parser reads a pattern description file in a given format and build up a complete PAT data base. A driver creates a text file in a given format from a PAT data base. A pat format parser-driver is available in the libPpt106.a library. Pattern description envolves the following notions (for further details see pat(5)): input port controlled by the user output signal or port observed by the user initialization forcing the value of a register pattern sequence list of values to be forced on inputs or to be checked as the result of the simulation on outputs The input-output list is represented by two data structures: pagrp contains informations relative to actual or virtual arraies and, paiol represents a one-bit input-output. Both are simply chained lists. However, to make a more efficient access to paiol structures, they are organized in a table. So, a paiol can also be addressed using an offset. Another group of data structures is used to represent a pattern. paini contains values to be forced into registers before processing the pattern. An event (a modification of value) on an input-output is given by a paevt structure. A third structure, papat gathers all infor- mation concerning a pattern (including initializations - paini - and events - paevt). A pacom is used to represent a comment. Finally, all these structures can be accessed through a unique structure, paseq, designed to represent a complete sequence of simulation patterns. ORGANIZATION
In order to use PAT, concepts on use of libraries are needed. And, since these libraries are under development, the code is subject to change. To enable work, a static version of each library is always present for the user. Libraries and header files are suffixed by a number (the library's version). The programmer can prefer to work with an earlier version of a library rather than the most recent one. However, it is recommended to adapt softwares to libraries as soon as possible in order to spotlight potential compatibility problems before old libraries are removed. A makefile is necessary for all PAT applications. This is required because any soft must be easily recompilable, and knowing the needed libraries for a PAT based program is not an easy matter. It can't be achieved by an other way, so do use makefile. In terms of software organization, PAT is splitted into two libraries for the basic functions, a header file for structures and variable declarations and, up to now, one parser-driver library for pat format. It is to be noticed that library's version number is incremented when, at least, one function composing the library has been modified. Therefore, PAT libraries may evolve independently form each other. Here follows the list of the libraries and their contents. libPat106.a: pat_addpaseq, pat_addpagrp, pat_addpaiol, pat_addpapat, pat_addpaevt, pat_addpaini, pat_addpacom, pat_frepaini, pat_frepaiol, pat_frepacom, pat_frepapat, pat_frepaevt, pat_crtpaiol libPhl106.a: pat_debug, pat_getcount libPpt106.a: pat_lodpaseq, pat_savpaseq, pat_drvpat, pat_prspat The libraries are organized in such a way that no cycle can appear through calls. It means that, if in a given library a function calls another function in another library, then none of the functions of this one does call any function that belongs to the first library. EXAMPLE
In order to use PAT libraries, one needs something like this in its makefile: HEADER = -I/labo/include LIB = -L/labo/lib -lPat106 -lPhl106 -lPpt106 -lMut315 SEE ALSO
mbk(1), pat(5) BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. ASIM
/LIP6 October 1, 1997 LIBPAT(3)
All times are GMT -4. The time now is 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy