12-22-2010
Quote:
Originally Posted by
scottn
Use nawk on Solaris.
Thanks It worked with nawk and gawk.
but the above code has one problem for example if pattern1 is character a, pattern2 is b and pattern3 is c, if the input data is in the folowing order:
a
d
b
a
e
c
b
the output would be the:
a
d
b
a
e
c
(since f is not reseted when a new range match is found), but I wanted to print only the last range found before finding pattern3, I needed the output to be like:
a
e
c
b
---------- Post updated at 02:03 AM ---------- Previous update was at 01:57 AM ----------
Another thing also, this won't work if pattern3 is in the range of pattern1 and pattern2 (like the above example) because printing will happen only in the range between pattern1 and pattern3, right?
and could the code be fixed to take care of such point?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI all
I'm trying to write an awk script to print the min and max value in a range(s) contained in another file - the range values are in $2
EG
114,7964,1,y,y,n
114,7965,1,y,y,n
114,7966,1,y,y,n
114,7967,1,y,y,n
114,7969,1,y,y,n
114,7970,1,y,y,n
114,7971,1,y,y,n
114,7972,1,y,y,n... (3 Replies)
Discussion started by: Mudshark
3 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I am trying to extract lines bsed on pattern matching../mp straight-flow/
Extracted output should be saved in meta_string , but the code is not working in that manner,saving repeated lines. can anyone please suggest where am i going wrong.
/mp straight-flow/ {... (6 Replies)
Discussion started by: madhaviece
6 Replies
3. Shell Programming and Scripting
How would I pass awk output to a perl variable?
For example, I want to save the value in the 4th column into the variable called test. My best guess is something as follow, but I am sure this isn't correct.
$test = system("awk '/NUMBER/{print \$4}' $_"); (8 Replies)
Discussion started by: userix
8 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I am trying to use AWK to do some editing and formating of large tables of numbers and I am having trouble getting it to work. For brevities sake, I won't show the whole table, but I have a sample set of code:
und$ awk '{($2+0) > 50;print $1}' temp
2000 147
2008 128
2002 100
1999 47... (2 Replies)
Discussion started by: ikerrin1@gmail.
2 Replies
5. Shell Programming and Scripting
# foreach sub ( sub001 )
sub=sub001
cd /mnt/stor/smith/recog/$sub/event_files/timecorrected/
awk '{$1-1.5}' $sub_CR
end
What im trying to do is:
1. open a 1D file that consists of lists of integers in rows a columns
2. subtract 1.5 from each integer in the first column
3. save the file... (1 Reply)
Discussion started by: ac130pilot
1 Replies
6. Shell Programming and Scripting
Hello all,
Let's say we have this file :
$ cat inputfile
2
3
4
7
8
11
15
16
17
I'm trying to make a script with awk which gives as output the following : (4 Replies)
Discussion started by: rany1
4 Replies
7. Shell Programming and Scripting
Is it possible to save the result of an AWK match to use later in a BASH script.
Thanks,
Jordon (4 Replies)
Discussion started by: jhirshon
4 Replies
8. Shell Programming and Scripting
Hello guys, I just start trying out AWK and encounter a problem, I try to think a bit but seems my way is incorrect.
I have two input file, with the first file has only one field, the second file has 3 fields, I suppose to do stuffs to them by writing an awk program, kinda sort them out. Since I... (15 Replies)
Discussion started by: RozenKristal
15 Replies
9. Shell Programming and Scripting
Hi,
I have a text file, which I am trying to parse.
File contents:
BEG
Id Job1
Id Stage1
1
EN
Id Job2
Id Stage2
BEG
Id2 Job3
Id Stage4
2
EN
I have to process the data in this between every BEG and EN. so I am trying to restrict the range and inside every... (1 Reply)
Discussion started by: Kulasekar
1 Replies
10. Shell Programming and Scripting
Dear Unix gurus,
I have sample data organised like this and containing 6 columns (with headers):
label c2 c3 c4 c5 c6
where c2 to c6 are numeric values in columns c2 to 6.
I am trying to create a simple output in a new file containing 3 columns:
label max(c2 c3) max(c4 c5 c6)
... (4 Replies)
Discussion started by: ksennin
4 Replies
LEARN ABOUT CENTOS
grub2-mkfont
GRUB-MKFONT(3) Library Functions Manual GRUB-MKFONT(3)
NAME
grub-mkfont -- Convert common font file formats into the PF2 format.
SYNOPSIS
grub-mkfont [--ascii-bitmaps] [-a | --force-autohint]
[-b | --bold] [-c | --asce=NUM] [-d | --desc=NUM]
[-i | --index=NUM] [-n | --name=NAME] [--no-bitmap]
[--no-hinting] <-o | --output=FILE>
[-r | --range=FROM-TO[,FROM-TO]] [-s | --size=SIZE]
[-v | --verbose] [--width-spec] FONT_FILES
DESCRIPTION
grub-mkfont converts font files from common formats into the PF2 format used by GRUB.
OPTIONS
--ascii-bitmaps
Save only bitmaps for ASCII characters.
--force-autohint
Force generation of automatic hinting.
--bold Convert font to bold.
--asce=NUM
Set font ascent to NUM.
--desc=NUM
Set font descent to NUM.
--index=NUM
Select face index NUM.
--name=NAME
Set font family to NAME.
--no-bitmap
Ignore bitmap strikes when loading.
--no-hinting
Disable hinting.
--output=FILE
Save ouptut to FILE. This argument is required.
--range=FROM-TO,FROM-TO
Set the font ranges to each pair of FROM,TO.
--size=SIZE
Set font size to SIZE.
--verbose
Print verbose messages.
--width-spec
Create a width summary file.
FONT_FILES
The input files to be converted.
SEE ALSO
info grub
Wed Feb 26 2014 GRUB-MKFONT(3)