Awk inside Awk expression


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Awk inside Awk expression
# 1  
Old 12-02-2009
Awk inside Awk expression

Hi,

It can be used awk inside other Awk?. I need to get another text processing while other text process.

Thank you.
# 2  
Old 12-02-2009
can you explain your question with some example??
# 3  
Old 12-03-2009
Hi,

I have a text with lines in this format:

Code:
BTSOSP¤FTSP001¤PARC¤OSP_ELRCOD¤CLMB5802¤1¤OSP_ELRSI¤AB5802/Albacete/ALBACETE/ALBACETE/02005¤0¤OSP_ELRMOD¤Ericsson/RBS 3418 - - ¤0¤<ATR>¤ON AIR¤<PRM>¤ON AIR¤1+1+1¤Urbano¤2007-11-19 00:00:00.0¤CON¤AVENIDA/ Menendez y Pidal/48¤39-0-14.06-N¤1-51-46.47-W¤676¤B¤C.P. MENENDEZ Y PIDAL Nº 48¤JOSE ANTONIO MARTINEZ GONZALEZ¤Privado¤MENENDEZ Y PIDAL Nº 48¤967604133¤C.P. MENENDEZ Y PIDAL Nº 48¤MENENDEZ Y PIDAL Nº 48¤967604133¤JOSE ANTONIO MARTINEZ GONZALEZ¤ES EL CRUCE DE LA CTRA. MADRID Y LA CIRCUNVALACION. ES LA PUERTA DE ASCENSORES.

Another would use it as a text configuration file. This would indicate the number of fields that should have each line of text above and fields that can not go to zero.
We should check first if the first text field 2 is in the second and if you look at the values they have. For example the second text would have the following format:

Code:
FTSP001 | 52 | 1 | 2 | 3

FTSP001: Campo second first file
52: Number line fields
1,2,3: Fields that can not come to zero

Thank you.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to evaluate expression under awk?

I have to display only those subscribers which are in "unconnected state" and the date is 90 days older than today's date. Below command is used for this purpose: cat vfsubscriber_20170817.csv | sed -e 's/^"//' -e '1d' | \ nawk -F '",' '{if ( (substr($11,2,4) == 2017) && ( substr($11,2,8)... (1 Reply)
Discussion started by: dia
1 Replies

2. Shell Programming and Scripting

Evaluate Expression within awk

I want to create a conditional expression string and pass in an awk script. My script is as below... comm="\$3 == "hello"" awk -F "^T" -v command="${comm}" ' { if ( command ) { print "hye" } }' testBut the statement "if ( command )" always evaluates to true which is not... (5 Replies)
Discussion started by: Saikat123
5 Replies

3. Shell Programming and Scripting

awk regular expression

Hello, I have big files which I wanna filter them based on first column. first column should be one of these strings: chr2L || chr2R || chr3L || chr3R || chr4 || chrX and something like chr2Lh or chrY or chrM3L is not accepted. I used the following command: awk '{ if ($1=="chr2L" ||... (5 Replies)
Discussion started by: @man
5 Replies

4. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

5. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

6. Shell Programming and Scripting

awk reg expression

Hello, I have thousand of messages (HL7), I want to use awk to extract only the ones that have a particular value in pv1.18 Each record in the file is the whole HL7 message, ie. when I print $0 I get the whole message MSH EVN PID etc. ,there is an x0d between the segments. I would like to use a... (3 Replies)
Discussion started by: gio001
3 Replies

7. Shell Programming and Scripting

awk inside another awk statement

hi all, i have two files 1) a.txt one two three 2) abc "one" = 10 pqr "three" = 20 345 "two" = 0 this is what i want in third file (3 Replies)
Discussion started by: shishirkotkar
3 Replies

8. Shell Programming and Scripting

Regular expression in AWK

Hello world, I was wondering if there is a nicer way to write the following code (in AWK): awk ' FNR==NR&&$1~/^m$/{tok1=1} FNR==NR&&$1~/^m10$/{tok1=1} ' my_file In fact, it looks for m2, m4, m6, m8 and m10 and then return a positive flag. The problem is how to define 10 thanks... (3 Replies)
Discussion started by: jolecanard
3 Replies

9. Shell Programming and Scripting

Check for more than one expression using AWK

I have a txt file like below: testin.txt AB BC CD DE I have the following awk script BEGIN {flag1="N"} /(AB)|(BC)|(CD)|(DE)/ {flag1="Y"} END {print flag1} >awk -f testin.awk testin.txt Returns Y (8 Replies)
Discussion started by: visakhcr
8 Replies

10. Shell Programming and Scripting

awk and regular expression

Ive got a file with words and also numbers. Bla BLA 10 10 11 29 12 89 13 35 And i need to change "10,29,89,25" and also remove anything that contains actually words... (4 Replies)
Discussion started by: maskot
4 Replies
Login or Register to Ask a Question