I'm searching some kind of example (or ready-made solution, but I don't really want it, because I want to learn awk more), to make something like a parser in awk for something like this (I put example, because I don't really know how to explain this):
And I want to have output like this:
I mean... I want to export from one file whole lines from "[something]" to "\n" which have line3=5
I have to notice, that lines aren't in same amount, for example there can be:
But can be also:
etc.
Is it possible to made? And sorry for my english, I'm still learning
Well, if you want a hint to start with, then consider this: if you run AWK like this:
then it will split file to records separated by empty lines, not by newline characters, so first record (NR==1) will be
second (NR==2) will be
and so on. You can then search each of those records for "line3=5" with regular expression.
Thanks, about this RS="" I even tried RS="\n[something]", which is wrong as I think, but I don't really have idea how to write this.
Now I made, that I'm getting this specify line or whole lines, but I have to make for it loop for as I think, right?
And how exactly could I search in whole lines? Because for now, I'm making it in this way (specify line and I'm looking for a way to search all lines):
It is some kind of succes for me
And about loop, I tried to make it in this way, but it won't send me anything:
In my thinking, teoretically it should increase NR by 1, but it seems, that I don't really know how to build a loop "for"
Yes, it's working exactly how I wanted, even I didn't dream, that it could be that short code.
Thank You so much.
Or maybe not, damn, with longer things (not like with my example) it just copy whole ini instead of specify lines, hmm strange... So maybe I'll try to make something with this loop
Yes, it's working exactly how I wanted, even I didn't dream, that it could be that short code.
Thank You so much.
Or maybe not, damn, with longer things (not like with my example) it just copy whole ini instead of specify lines, hmm strange... So maybe I'll try to make something with this loop
Do those longer things have each block separated by an empty line?
I want the developers to get a mail with Java stack traces on a daily bases. When something is flaged as known issue and will get a fix but mean while this does not need to get sent each dayl. This is what I got so far. It's a bash script that runs some AWK in it.
To get the files that needs to... (6 Replies)
I have an awk parser, that works great if the data is NC_0000 (four digits), but if it is not that then the data is parsed. I'm not sure the most efficient way to obtain the desired output. Thank you :).
Code:
awk 'FNR > 1 && match($0, /NC_0000(*)\..*g\.(+)(.)>(.)/, a){ print a, a, a, a, a }'... (14 Replies)
I want to develop a simple command line parser so that then I can print the values of different options :tions.
-analyze
-filename<fileName>
Via man pages I got to know getopt command would be used.
Buut how to use it.. how to encrypt this in a perl script..
grateful if u could help (2 Replies)
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Hi!
I have a difficult problem, to step up a unknown version number in a text file, and save the file. It would be great to run script.sh and the version gets increased.
Example the content of the textfile.txt
hello
version = x
bye
This include three steps
1. First find the char after... (2 Replies)
I have thousands of files in HTML that looks like this:
....
....
....
<!-- table horaire --> <!-- table horaire -->
<table border="0" cellspacing="0" cellpadding="0" class="tblHoraires" summary="Table des horaires de la ligne 12">
<tr>
<th scope="row"... (13 Replies)
This is a fairly basic advanced question!
Does anyone happen to know what level of page faults should be acceptable on a fully operational production system?
Useful (?) information:
Production system using Oracle database
Compaq Tru64 UNIX Server (not sure what model, but it's big!)
8... (14 Replies)