Originally posted by oombera
[W]on't the two lines
only pick up on, say,
but not
?
Nope. Your confusion may come from a mistaken notion that the pattern/action pairs look like exclusive cases, but you should look at them like a C switch statement: You fall through to the next "case" (awk "pattern") unless you encounter a "break" (awk "next"). So NF == 0 { next } skips empty lines. Then NF == 4 { tag = $1 } picks up the first field and goes to the next pattern when there are four fields. The next pattern is empty, so it matches every line that wasn't "next"-ed so far, and its action is to print the saved tag and the last two fields from the current input line. If there is exactly one field on a line, awk will break in this last case, but that wasn't part of the OP's stated problem.
Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)
I want to write a scrpit to merge files row wise (actually concatinating)
main.txt
X Y Z
file 1
A B C
file 2
1 2 3
now i want the script to check if the file1 is empty or not, if empty then make it like
A B C
1 2 3
again to check if second file is empty if not do as done... (0 Replies)
Hello Everyone,
My issue is that I want to traverse a database table row by row and do some action on the value retrieved in each row.
I have gone through a lot of shell script questions/posts. I could find row by row traversal of a file but not a database table.
Please help.
Thanks &... (5 Replies)
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
Hi, I already succeed moving a new row to another table if the field from new row doesn't have the first word that I categorized (like: IRC blablabla, PTM blablabla, ADM blablabla, BS blablabla).
But it can't delete the old row. Please help me with the script.
my php script:
INSERT INTO... (2 Replies)
Hi.
How can we print those rows of file2 which are mentioned in file1. first character of file1 is a row number.. for eg
file1
1:abc
3:ghi
6:pqr
file2
a abc
b def
c ghi
d jkl
e mno
f pqr
... (6 Replies)
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)
Hi ALL,
We have requirement in a file, i have multiple rows.
Example below:
Input file rows
01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212
01,1,102319,0,1,80,20,U,1,241,00000059420000006021
I need my output file should be as mentioned below. Last field should split for... (4 Replies)
This is a question that is related to one I had last August when I was trying to sort/merge two files by millsecond time column (in this case column 6).
The script (below) that helped me last august by RudiC solved the puzzle of sorting/merging two files by time, except it gets lost when the... (0 Replies)
Discussion started by: aachave1
0 Replies
LEARN ABOUT DEBIAN
swiss::stars
SWISS::Stars(3pm) User Contributed Perl Documentation SWISS::Stars(3pm)NAME
SWISS::Stars.pm
DESCRIPTION
SWISS::Stars represents the ** lines within an SWISS-PROT + TrEMBL entry. These are the lines with the line tag ** which are normally not
publicly visible.
SWISS::Stars is a master object like SWISS::Entry. It contains subobjects which represent the different line types in the ** section. Each
line type has a two letter tag in addition to the ** line tag. This module has been written to allow easy addition of new ** line types. To
use a new ** line tag, just use the tag as an object dereference. Example:
$entry->Stars->XX->add("New XX tag line.","Second new XX tag line.");
If there is no class SWISS::Stars::XX, the class of the new object will be SWISS::Stars::default, which handles lines with the
corresponding tag as an array of lines. If more specific handling is required, a new class SWISS::Stars::XX can be created following the
template of SWISS::Stars::default. An example is SWISS::Stars::aa.
Subclass names and new line tags have to be two-letter-tags. No checks are made wheter the dereferenced tag is allowed.
Access to the (old) unstructured ANNOTATOR'S SECTION is provided by the line tag 'aa'.
$entry->Stars->aa->add("Testline 1.","Second new test line.");
will add these two lines to the ANNOTATOR'S SECTION.
Inherits from
SWISS::BaseClass.pm
Attributes
No public attributes apart from the subclasses.
Methods
Standard methods
new
fromText
toText
update
perl v5.10.1 2006-01-26 SWISS::Stars(3pm)