Help me out: what does {NF--NF} do in your second awk script do? An uncommon construct, at least to me...
For your problem, how about
Hi RudyC,
Thanks so much...your codes work great on my real data.
If you notice, I created $20 to put in the total of $5 - $4. I need to remove $20 (last column) from being printed out in the final output. Therefore, i used {NF--NF} for that purpose. It was just my silly way I guess.
Hi,
I want to know if you can input with sed but instead of specifing a line number like below I wan't to be able to insert based on a specific word or patttern.
10i\
Insert me after line 10
is this possible with sed or should I use AWK?
Thanks
Jack (2 Replies)
I am really need help with the regular expression in SED. From input file, I need to extract lines that have the port number (sport or dport) as defined. The input file is something like this
time=1209515280-1209515340 dst=192.168.133.202 src=208.70.8.23 bytes=2472 proto=6 sport=80 dport=1447... (6 Replies)
Hi,
If there exist multiple pattern in a file, how can I find the last record matching the pattern through perl.
The below script searches for the pattern everywhere in an input file.
#! /usr/bin/perl -s -wnl
BEGIN {
$pattern or
warn"Usage: $0 -pattern='RE' \n" and
exit 255;... (5 Replies)
I am working on a scraping project and I am stuck at this tiny grep pattern match.
Sample text :
FPA List. FPA List. FPA List. FPA List. FPA List. FPA List. FPA List. FPA List.
ABC Personal Planning
Catherine K. Wat
Cath Wat
Catherine K. Wat
Catherine K. Wat
IFRAME:... (8 Replies)
Hi all,
I have a text data file. My aim here is to find line called *FIELD* AV for every record and print lines after that till *FIELD* RF. But here I want first 3 to four lines for very record as well. FIELD AV is some where in between for very record. SO I am not sure how to retrieve lines in... (2 Replies)
Hi,
I need some help on how to print the whole data for unmatched pattern. i have 2 different files that need to be checked and print out the unmatched patterns into a new file. My sample data as follows:-
File1.txt
Id Num Activity Class Type
309 1.1 ... (5 Replies)
Hi,
I have script like below:
#!/usr/local/bin/perl
use strict;
use warnings;
while (<DATA>) {
( my ($s_id) = /^\d+\|(\d+?)\|/ ) ;
if ( $s_id == 1 ){
s/^(.*\|)*.*ABC\.pi=(+|+)*.*ABC\.id=(\d+|+).*$/$1$2|$3/s;
print "$1$2|$3\n"; (2 Replies)
Hello Friends,
I need to print lines in between two string when a keyword existed in those lines (keywords like exception, error, failed, not started etc).
for example,
input:
..
Begin Edr
ab12
ac13
ad14
bc23
exception occured
bd24
cd34
dd44
ee55
ff66
End Edr (2 Replies)
Hi experts,
I have a file with regexes which is used for automatic searches on several files (40+ GB).
To do some postprocessing with the grep result I need the matching line as well as the match itself.
I know that the latter could be achieved with grep's -o option. But I'm not aware of a... (2 Replies)
Hi I want to print the line until pattern is matched.
I am using below code:
sed -n '1,/pattern / p' file
It is working fine for me , but its not working for exact match.
sed -n '1,/^LAC$/ p' file
Input:
LACC FEGHRA 0
LACC FACAF 0
LACC DARA 0
LACC TALAC 0
LAC ILACTC 0... (8 Replies)
Discussion started by: Abhisrajput
8 Replies
LEARN ABOUT NETBSD
wump
WUMP(6) BSD Games Manual WUMP(6)NAME
wump -- hunt the wumpus in an underground cave
SYNOPSIS
wump [-h] [-a arrows] [-b bats] [-p pits] [-r rooms] [-t tunnels]
DESCRIPTION
The game wump is based on a fantasy game first presented in the pages of People's Computer Company in 1973. In Hunt the Wumpus you are
placed in a cave built of many different rooms, all interconnected by tunnels. Your quest is to find and shoot the evil Wumpus that resides
elsewhere in the cave without running into any pits or using up your limited supply of arrows.
The options are as follows:
-a Specifies the number of magic arrows the adventurer gets. The default is five.
-b Specifies the number of rooms in the cave which contain bats. The default is three.
-h Play the hard version -- more pits, more bats, and a generally more dangerous cave.
-p Specifies the number of rooms in the cave which contain bottomless pits. The default is three.
-r Specifies the number of rooms in the cave. The default cave size is twenty rooms.
-t Specifies the number of tunnels connecting each room in the cave to another room. Beware, too many tunnels in a small cave can eas-
ily cause it to collapse! The default cave room has three tunnels to other rooms.
While wandering through the cave you'll notice that, while there are tunnels everywhere, there are some mysterious quirks to the cave topol-
ogy, including some tunnels that go from one room to another, but not necessarily back! Also, most pesky of all are the rooms that are home
to large numbers of bats, which, upon being disturbed, will en masse grab you and move you to another portion of the cave (including those
housing bottomless pits, sure death for unwary explorers).
Fortunately, you're not going into the cave without any weapons or tools, and in fact your biggest aids are your senses; you can often smell
the rather odiferous Wumpus up to two rooms away, and you can always feel the drafts created by the occasional bottomless pit and hear the
rustle of the bats in caves they might be sleeping within.
To kill the wumpus, you'll need to shoot it with one of your magic arrows. Fortunately, you don't have to be in the same room as the crea-
ture, and can instead shoot the arrow from as far as three or four rooms away!
When you shoot an arrow, you do so by typing in a list of rooms that you'd like it to travel to. If at any point in its travels it cannot
find a tunnel to the room you specify from the room it's in, it will instead randomly fly down one of the tunnels, possibly, if you're real
unlucky, even flying back into the room you're in and hitting you!
BSD January 19, 2006 BSD