I have found either a GNU-grep or a GNU work-alike on:
I will admit that I don't recall if I installed the GNU code in Solaris and OI, but it must not have been much work if I did. The codes are in very differently-named directories, often not in default path settings, so I would not be surprised that many people do not know about them (and their associated man pages).
Virtually all supercomputers use Linux (ibid.). When I worked in one of the supercomputer centers, the initial Cray-2 used a variant of AT&T Unix, but these days most have shifted over to a form -- often custom -- of Linux. Similar for the ETA10. The TMC TM-5 used Unix in all the nodes as I recall. The 3090s used Unix in VMs (too long ago, but possibly AIX).
Of the "other", I looked at AIX and HP-UX. The AIX7 to which I had access offered GNU grep. I could not find it on HP B.11.11.
The mainframe OSs are usually whatever IBM has for the OS/390 follow-ons, z/OS, but also Linux and openSolaris.
CPAN has a number of grep work-alikes (written in perl, available for copying into one's own home-bin, not needed to install in the system), for example: http://www.cpan.org/authors/id/A/AD/ADAVIES/peg-3.10 which has the context-printing capability (-B, as well as -A and -C). This code, peg, was quickly made to work on HP-UX, and:
worked as one would expect from GNU grep.
*shrug* I don't know what to tell you then, since a very frequent use of awk is reinventing -B for all the posters here which don't happen to have it. Perhaps we don't get an "average" distribution of people, or perhaps "average" is a bad metric to use (how many people here manage *super*computers?) etc.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Quote:
Originally Posted by Corona688
*shrug* I don't know what to tell you then, since a very frequent use of awk is reinventing -B for all the posters here which don't happen to have it. Perhaps we don't get an "average" distribution of people, or perhaps "average" is a bad metric to use (how many people here manage *super*computers?) etc.
I'm looking for a way to print the 4th line back from a regular expression. Kind of like the below but it has to be the 4th line before the regexp.
Print the line immediately before regexp, but not the line containing the regexp.
here is an example of logs(i chopped the logs bc each line is too long)
I'm looking for "SendProv has thrown exception" and want to parse the MDN where it threw the exception.
Any ideas?
The ex utility fits the bill in case you'd consider it...
Only caveat here is that the desired line has to be exactly 4 lines before the supplied regexp...
Hi All,
I need to print the characters in the previous line just before the regular expression match
Please have a look at the input file as attached
I need to match the regular expression ^ with the character of the previous like and also the pin numbers
and the output file should be like... (6 Replies)
im trying to get
awk to print the string between 3rd and 4th backslashs to end of line
test could be any word
this
http://example.com/test/ >to this
http://example.com/test/ > testalso the other way round insert string at end of line... (13 Replies)
How to use regexp to print out repetitive pattern in awk?
$ awk '{print $0, "-\t-\t-\t-\t-\t-\t-\t-\t-\t-\t-\t-"}' output:
- - - - - - - - - - - -I tried following which does not give what I want, of course.
awk '{print $0, "-\t{11}-"}'
output:
- ... (10 Replies)
Hi All
I'm trying to extract the line just above a regexp and all lines after this.
I'm currently doing this in two steps
sed -n -e "/^+---/{g;p;}" -e h oldfile.txt > modified.txt
sed -e "1,/^+---/d" -e "/^$/d" oldfile.txt >>modified.txt
Sample
sometext will be here
sometext will be... (3 Replies)
Hello all
According to the following file (orignal one contains 200x times the same structure...) I was wondering if someone could help me to print <byte>??</byte> values
example, running this script/command like
./script.sh xxapp
I would expect as output: 102 116 112
./script.sh xxapp2... (2 Replies)
Hi,
I have a file, say files_list, as below (o/p of ls -R cmd)
$ cat files_list
/remote/dir/path/to/file:
sub-dir1
sub-dir2
sub-dir3
...
/remote/dir/path/to/file/sub-dir1:
remote_file1.csv.tgz
<blank line 1>
/remote/dir/path/to/file/sub-dir2:
remote_file2.csv.tgz
<blank... (3 Replies)
Hi all,
This should be very easy but I can't figure it out...
I have a file that looks like this:
@SRR057408.1 FW8Y5CK02R652T length=34
AGCAGTGGTATCAACGCAGAGTAAGCAGTGGTAT
+SRR057408.1 FW8Y5CK02R652T length=34
FIIHFF6666?=:88@@@BBD:::?@ABBAAA>8
@SRR057408.2 FW8Y5CK02TBMHV length=52... (1 Reply)
I am on a Solaris 10 x86 system
sample code
before3
before2
before1
group
after1
after2
after3
I want to grab the second line above my regexp
regexp=group
I want to grab ONLY the before2 line
I have numerous sed and awk ways of grabbing X line below the regexp, but no luck... (1 Reply)
Good Day,
Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp.
sed -n '/regexp/{n;p;}' filename
What if my regexp is 3 word or a sentence. Im... (3 Replies)
Hi,
How do i Print anything after a ':'
Ex :
file1: 1235131(rs32553)
I want to print out "1235131(rs32553)"
how do i do it. I know we can do this using awk but looking for the right syntax.
Any help appreciated.
Thanks,
Ram (7 Replies)