Tuesday, July 31, 2007

LVM

[ROOT abc123]home/root # uname -a
HP-UX abc123 B.11.11 U 9000/800 170187401 unlimited-user license
[ROOT abc123]home/root # lvextend -L 600 /dev/vgs12xyz/lvxyz
[ROOT abc123]home/root # fsadm -F vxfs -b $((600*1024)) /db99/S99/db


Note: If you encounter "errno 28" then you need to free up some space before extending the fs

read more...

Monday, July 30, 2007

SunOS: Route delete problem

If you ever encouter problem deleting routing in SunOS, make sure you specify the netmask.

For example:
1. add routing:
root@xyz # route add -net 123.45.57.0 34.56.78.1 -netmask 255.255.255.192

2. out of no reason, you want to delete routing that u just add:
root@xyz # route delete -net 123.45.57.0 34.56.78.1
delete net 123.45.57.0: gateway 34.56.78.1: not in table
root@xyz #


you will received error msg as above.

So, what you need to do is to specify the netmask, such as:
root@xyz # route delete -net 123.45.57.0/26 34.56.78.1

* to check netmask for the specific entry, use command: root@xyz # netstat -rvn
Voila!

read more...

Friday, July 27, 2007

..

I must learn to be more confident in decision making.

I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.
I must learn to be more confident in decision making.

'Nuff said.

read more...

Monday, July 23, 2007

Still... haven't started my engine..

For the past 2 weeks, I've done nothing but trained myself to familiarize with new surroundings, new tasks that I'm gonna be in deep shit later, and finding the right food(s) to eat when it is time to eat.

I would say, I enjoy the every bit of that moment, saving it up for the future.

Well, today, I started to get bored. So I took up some problem(s) and put it in my basket.

I'm not much of a writer, so if you found my writing sucks, put your socks in your mouth.

One interesting problem that I found is on system running UNITED Linux on IBM BladeCenter. Apprarently, some weird error(s) were generated that makes us engineers annoyed.

It all started when one lucky engineer stumbled upon syslog message that looks like this:
Jul 13 14:26:34 abc123 kernel: sdb : READ CAPACITY failed.
Jul 13 14:26:34 abc123 kernel: sdb : status = 1, message = 00, host = 0, driver = 08
Jul 13 14:26:34 abc123 kernel: Current sd00:00: sense key Not Ready
Jul 13 14:26:34 abc123 kernel: Additional sense indicates Medium not present
Jul 13 14:26:34 abc123 kernel: sdb : block size assumed to be 512 bytes, disk size 1GB.
Jul 13 14:26:34 abc123 kernel: sdb: Write Protect is on
Jul 13 14:26:34 abc123 kernel: sdb: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 2097144
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 2097144
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:34 abc123 kernel: unable to read partition table
Jul 13 14:26:35 abc123 kernel: I/O error: dev 08:10, sector 0
Jul 13 14:26:35 abc123 kernel: sdb : READ CAPACITY failed.
Jul 13 14:26:35 abc123 kernel: sdb : status = 1, message = 00, host = 0, driver = 08
Jul 13 14:26:35 abc123 kernel: Current sd00:00: sense key Not Ready
Jul 13 14:26:35 abc123 kernel: Additional sense indicates Medium not present
Jul 13 14:26:35 abc123 kernel: sdb : block size assumed to be 512 bytes, disk size 1GB.
Jul 13 14:26:35 abc123 kernel: sdb: Write Protect is on


At first I thought the harddisk went into the toilet already, but, is there any harddisk that can enable Write Protect? When I checked the hardware dbase, the /dev/sdb is *NOT* a harddisk. So I started to dig deeper and found out that /dev/sdb is a device from TEAC with model no. FD-05PUB. What the f..? *FD*? FD == Floppy Disk? The right place to ask is here. So I Google up and found this one interesting PDF document.

In that document, under section 4.5 "Issues related to Red Hat AS 2.1/3.0 and Blades" stated that:
[quote]
When a blade boots and the media tray is assigned to during boot up, the floppy drive in the media tray is assigned as (in this example) /dev/sdc. However, since there is no diskette in the drive, we see the following errors (beginning at READ CAPACITY FAILED):
Nov 5 09:44:30 spencerooni kernel: hub.c: new USB device 00:0f.2-1.1, assigned address 3
Nov 5 09:44:30 spencerooni kernel: usb.c: USB device 3 (vend/prod 0x644/0x0) is not claimed by any active driver.
Nov 5 09:44:30 spencerooni kernel: hub.c: new USB device 00:0f.2-1.3, assigned address 4
Nov 5 09:44:30 spencerooni kernel: usb.c: USB device 4 (vend/prod 0x5ab/0x30) is not claimed by any active driver.
Nov 5 09:44:30 spencerooni kernel: Initializing USB Mass Storage driver...
Nov 5 09:44:30 spencerooni kernel: usb.c: registered new driver usb-storage
Nov 5 09:44:30 spencerooni kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Nov 5 09:44:30 spencerooni kernel: Vendor: TEAC Model: FD-05PUB Rev: 2000
Nov 5 09:44:30 spencerooni kernel: Type: Direct-Access ANSI SCSI revision: 02
Nov 5 09:44:30 spencerooni kernel: Attached scsi removable disk sdc at scsi1, channel 0, id 0, lun 0
Nov 5 09:44:30 spencerooni kernel: sdc : READ CAPACITY failed.
Nov 5 09:44:30 spencerooni kernel: sdc : status = 1, message = 00, host = 0, driver = 08
Nov 5 09:44:30 spencerooni kernel: Current sd00:00: sense key Not Ready
Nov 5 09:44:30 spencerooni kernel: Additional sense indicates Medium not present
Nov 5 09:44:30 spencerooni kernel: sdc : block size assumed to be 512 bytes, disk size 1GB.
Nov 5 09:44:30 spencerooni kernel: sdc: I/O error: dev 08:20, sector 0
Nov 5 09:44:30 spencerooni kernel: I/O error: dev 08:20, sector 0
Nov 5 09:44:30 spencerooni kernel: unable to read partition table


Now, that wouldn't be the end of the world, necessarily, However, ANYTIME the KVM is switched on the Bladecenter to/from that blade, the USB "stuff" (KVM and media tray) get re-hotplugged, for lack of a better term, and the sdc errors are generated. They occur even after switch the media tray owner to a different blade. The result is too many spurious errors which is making the internal support team cranky.

Modification 1: Do not boot blade with media tray assigned in order to avoid errors when someone takes the media tray away AND when the floppy drive is empty. NOTE: "alias floppy off" should be added to modules.conf to avoid floppy drive errors when media tray not assigned on boot.

One final note on this item: currently the media tray is required for installing Linux on the blades, but should only be needed in rare circumstances after that. Additionally, since there appear to be several combinations of events that will cause the EFI shell boot option to be restored in the boot sequence on a blade (see item 4), it is recommended that boot sequence be confirmed when an HS40 is rebooted until the firmware fix is released. This can be done by simply confirming that the
HS40 boots from the HBA during a restart. So these items should be included as required steps for building a Linux blade.

Modification 2: Leave read-only floppy diskette in the drive. This prevents the "Medium not present" errors from occurring. This is not a complete solution but is a good start. See #3 for more.

Modification 3: When media tray is assigned to a blade, it will automatically hotplug itself and the cdrom and floppy drive will be available for use. When use
media tray should be unassigned from the blade and/or the usb-storage module should be removed. The command for this is "rmmod usb-storage".

This step should also be performed when the IBM Remote Disk is used. The IBM Remote Disk is the feature where an image, or even the local floppy or CDROM drive can be mounted on the blade from the local machine.

I have not seen anything to indicate that a Red Hat kernel fix can be completed to prevent these error messages from being generated.
[/quote]


Pfft.

-- Updates on 27 July 2007
The modification 1 didn't work. Didn't have nerve to do "rmmod usb-storage", but it will be my last resort. Currently opting to disable the drive in the BIOS. Heh.

-- Updates on 30 July 2007
Gave advice to ignore the error message since it didn't effect the system performance. Kapisch?

read more...

Sunday, July 22, 2007

Read-More hacks

Got it from here.

Thanks yoebaik!

read more...

300 new servers? By next Tuesday?




Advice to employees on the proper use of the System Administrator's valuable time

(In following examples, we will substitute the name "Ted" as the System Administrator)

* Make sure to save all your MP3 files on your network drive. No sense in wasting valuable space on your local drive! Plus, Ted loves browsing through 100+ GB of music files while he backs up the servers.
* Play with all the wires you can find. If you can't find enough, open something up to expose them. After you have finished, and nothing works anymore, put it all back together and call Ted. Deny that you touched anything and that it was working perfectly only five minutes ago. Ted just loves a good mystery. For added effect you can keep looking over his shoulder and ask what each wire is for.
* Never write down error messages. Just click OK, or restart your computer. Ted likes to guess what the error message was.
* When talking about your computer, use terms like "Thingy" and "Big Connector."
* If you get an EXE file in an email attachment, open it immediately. Ted likes to make sure the anti-virus software is working properly.
* When Ted says he coming right over, log out and go for coffee. It's no problem for him to remember your password.
* When you call Ted to have your computer moved, be sure to leave it buried under a year-old pile of postcards, baby pictures, stuffed animals, dried flowers, unpaid bills, bowling trophies and Popsicle sticks. Ted doesn't have a life, and he finds it deeply moving to catch a glimpse of yours.
* When Ted sends you an email marked as "Highly Important" or "Action Required", delete it at once. He's probably just testing some new-fangled email software.
* When Ted's eating lunch at his desk or in the lunchroom, walk right in, grab a few of his fries, then spill your guts and expect him to respond immediately. Ted lives to serve, and he's always ready to think about fixing computers, especially yours.
* When Ted's at the water cooler or outside taking a breath of fresh air, find him and ask him a computer question. The only reason he takes breaks at all is to ferret out all those employees who don't have email or a telephone.
* Send urgent email ALL IN UPPERCASE. The mail server picks it up and flags it as a rush delivery.
* When the photocopier doesn't work, call Ted. There's electronics in it, so it should be right up his alley.
* When you're getting a NO DIAL TONE message at your home computer, call Ted. He enjoys fixing telephone problems from remote locations. Especially on weekends.
* When something goes wrong with your home PC, dump it on Ted's chair the next morning with no name, no phone number, and no description of the problem. Ted just loves a good mystery.
* When you have Ted on the phone walking you through changing a setting on your PC, read the newspaper. Ted doesn't actually mean for you to DO anything. He just loves to hear himself talk.
* When your company offers training on an upcoming OS upgrade, don't bother to sign up. Ted will be there to hold your hand when the time comes.
* When the printer won't print, re-send the job 20 times in rapid succession. That should do the trick.
* When the printer still won't print after 20 tries, send the job to all the printers in the office. One of them is bound to work.
* Don't use online help. Online help is for wimps.
* Don't read the operator's manual. Manuals are for wussies.
* If you're taking night classes in computer science, feel free to demonstrate your fledgling expertise by updating the network drivers for you and all your co-workers. Ted will be grateful for the overtime when he has to stay until 2:30am fixing all of them.
* When Ted's fixing your computer at a quarter past one, eat your Whopper with cheese in his face. He functions better when he's slightly dizzy from hunger.
* When Ted asks you whether you've installed any new software on your computer, LIE. It's no one else's business what you've got on your computer.
* If the mouse cable keeps knocking down the framed picture of your dog, lift the monitor and stuff the cable under it. Those skinny Mouse cables were designed to have 55 lbs. of computer monitor crushing them.
* If the space bar on your keyboard doesn't work, blame Ted for not upgrading it sooner. Hell, it's not your fault there's a half pound of pizza crust crumbs, nail clippings, and big sticky drops of Mountain Dew under the keys.
* When you get the message saying "Are you sure?", click the "Yes" button as fast as you can. Hell, if you weren't sure, you wouldn't be doing it, would you?
* Feel perfectly free to say things like "I don't know nothing about that boneheaded computer crap." It never bothers Ted to hear his area of professional expertise referred to as boneheaded crap.
* Don't even think of breaking large print jobs down into smaller chunks. God forbid somebody else should sneak a one-page job in between your 500-page Word document.
* When you send that 500-page document to the printer, don't bother to check if the printer has enough paper. That's Ted's job.
* When Ted calls you 30 minutes later and tells you that the printer printed 24 pages of your 500-page document before it ran out of paper, and there are now nine other jobs in the queue behind yours, ask him why he didn't bother to add more paper.
* When you receive a 130 MB movie file, send it to everyone as a high-priority mail attachment. Ted's provided plenty of disk space and processor capacity on the new mail server for just those kinds of important things.
* When you bump into Ted in the grocery store on a Sunday afternoon, ask him computer questions. He works 24/7, and is always thinking about computers, even when he's at super-market buying toilet paper and doggie treats.
* If your son is a student in computer science, have him come in on the weekends and do his projects on your office computer. Ted will be there for you when your son's illegal copy of Visual Basic 6.0 makes the Access database keel over and die.
* When you bring Ted your own "no-name" brand PC to repair for free at the office, tell him how urgently he needs to fix it so you can get back to playing EverQuest. He'll get on it right away, because everyone knows he doesn't do anything all day except surf the Internet.
* Don't ever thank Ted. He loves fixing everything AND getting paid for it!


read more...

Wednesday, July 11, 2007

Gentlemen, start your engines!

Well, basically I haven't started mine. Just got my new laptop on Monday and had been messing around this new gadget for 2 days already. But today is even better, I started to read, alot. So, don't expect any intelligent post(s) for today.

The new environment is, of course, different. But kinda like it here. Hopefully this gonna be my next long stop.

There's a lot of new things that I need to digest real quick and pray to God my brain won't explode. Those 'things' are most welcome by my brain, maybe because I'm new here, or maybe because of my willingness to accept that 'things'. I've been waiting for a very long time to learn that new 'things'!! Have you ever seen so damn many 'things' in one para? I know I did.

New friends, new workplace, new cubicle, new laptop, and (soon) new headache(s).

Oo-lala.

read more...

Sunday, July 8, 2007

The new beginning

Well, last Friday was my last day at SXXX. I missed my colleagues already. I missed the sweet old days I had with em and yah, the bitter days. But, a man's gotta do what a man's gotta do.

Tomorrow will be the new era of my life. I'm gonna start doing system administration, the one that has been one of my passion all this time. All that I hope is that my passion will eventually lead me somewhere far.

I'm not the type who has a lot of idea to write/type, especially when I'm started to write, so I'm gonna stop right here, for today of course.

Wish me luck, and God Bless you all.

read more...

Tuesday, July 3, 2007

awk notes

AWK syntax:
awk [-Fs] "program" [file1 file2...] # commands come from DOS cmdline
awk 'program{print "foo"}' file1 # single quotes around double quotes
# NB: Don't use single quotes alone if the embedded info will contain the
# vertical bar or redirection arrows! Either use double quotes, or (if
# using 4DOS) use backticks around the single quotes: `'NF>1'`

# NB: since awk will accept single quotes around arguments from the
# DOS command line, this means that DOS filenames which contain a
# single quote cannot be found by awk, even though they are legal names
# under MS-DOS. To get awk to find a file named foo'bar, the name must
# be entered as foo"'"bar.

awk [-Fs] -f pgmfile [file1 file2...] # commands come from DOS file

If file1 is omitted, input comes from stdin (console).
Option -Fz sets the field separator FS to letter "z".

AWK notes:
"pattern {action}"
if {action} is omitted, {print $0} is assumed
if "pattern" is omitted, each line is selected for {action}.

Fields are separated by 1 or more spaces or tabs: "field1 field2"
If the commands come from a file, the quotes below can be omitted.

Basic AWK commands:
-------------------
"NR == 5" file show rec. no. (line) 5. NB: "==" is equals.
{FOO = 5} single = assigns "5" to the variable FOO
"$2 == 0 {print $1}" if 2d field is 0, print 1st field
"$3 < 10" if 3d field < 10, numeric comparison; print line
'$3 < "10" ' use single quotes for string comparison!, or
-f pgmfile [$3 < "10"] use "-f pgmfile" for string comparison
"$3 ~ /regexp/" if /regexp/ matches 3d field, print the line
'$3 ~ "regexp" ' regexp can appear in double-quoted string*
# * If double-quoted, 2 backslashes for every 1 in regexps
# * Double-quoted strings require the match (~) character.
"NF > 4" print all lines with 5 or more fields
"$NF > 4" print lines where the last field is 5 or more
"{print NF}" tell us how many fields (words) are on each line
"{print $NF}" print last field of each line

"/regexp/" Only print lines containing "regexp"
"/text|file/" Lines containing "text" or "file" (CASE SENSITIVE!)

"/foo/{print "za", NR}" FAILS on DOS/4DOS command line!!
'/foo/{print "za", NR}' WORKS on DOS/4DOS command line!!
If lines matches "foo", print word and line no.
`"/foo/{print \"za\",NR}"` WORKS on 4DOS cmd line: escape internal quotes with
slash and backticks; for historical interest only.

"$3 ~ /B/ {print $2,$3}" If 3d field contains "B", print 2d + 3d fields
"$4 !~ /R/" Print lines where 4th field does NOT contain "R"

'$1=$1' Del extra white space between fields & blank lines
'{$1=$1;print}' Del extra white space between fields, keep blanks
'NF' Del all blank lines

AND(&&), OR(||), NOT(!)
-----------------------
"$2 >= 4 || $3 <= 20" lines where 2d field >= 4 .OR. 3d field <= 20
"NR > 5 && /with/" lines containing "with" for lines 6 or beyond
"/x/ && NF > 2" lines containing "x" with more than 2 fields

"$3/$2 != 5" not equal to "value" or "string"
"$3 !~ /regexp/" regexp does not match in 3d field
"!($3 == 2 && $1 ~ /foo/)" print lines that do NOT match condition

"{print NF, $1, $NF}" print no. of fields, 1st field, last field
"{print NR, $0}" prefix a line number to each line
'{print NR ": " $0}' prefix a line number, colon, space to each line

"NR == 10, NR == 20" print records (lines) 10 - 20, inclusive
"/start/, /stop/" print lines between "start" and "stop"

"length($0) > 72" print all lines longer than 72 chars
"{print $2, $1}" invert first 2 fields, delete all others
"{print substr($0,index($0,$3))}" print field #3 to end of the line


END{...} usage
--------------- END reads all input first.

1) END { print NR } # same output as "wc -l"

2) {s = s + $1 } # print sum, ave. of all figures in col. 1
END {print "sum is", s, "average is", s/NR}

3) {names=names $1 " " } # converts all fields in col 1 to
END { print names } # concatenated fields in 1 line, e.g.
+---Beth 4.00 0 #
input | Mary 3.75 0 # infile is converted to:
file | Kathy 4.00 10 # "Beth Mary Kathy Mark" on output
+---Mark 5.00 30 #

4) { field = $NF } # print the last field of the last line
END { print field }


PRINT, PRINTF: print expressions, print formatted
print expr1, expr2, ..., exprn # parens() needed if the expression contains
print(expr1, expr2, ..., exprn) # any relational operator: <, <=, ==, >, >=

print # an abbreviation for {print $0}
print "" # print only a blank line
printf(expr1,expr2,expr3,\n} # add newline to printf statements

FORMAT CONVERSION:
------------------
BEGIN{ RS=""; FS="\n"; # takes records sep. by blank lines, fields
ORS="\n"; OFS="," } # sep. by newlines, and converts to records
{$1=$1; print } # sep. by newlines, fields sep. by commas.

PARAGRAPHS:
-----------
'BEGIN{RS="";ORS="\n\n"};/foo/' # print paragraph if 'foo' is there.
'BEGIN{RS="";ORS="\n\n"};/foo/&&/bar/' # need both
;/foo|bar/' # need either

PASSING VARIABLES:
------------------
gawk -v var="/regexp/" 'var{print "Here it is"}' # var is a regexp
gawk -v var="regexp" '$0~var{print "Here it is"}' # var is a quoted string
gawk -v num=50 '$5 == num' # var is a numeric value

Built-in variables:
ARGC number of command-line arguments
ARGV array of command-line arguments (ARGV[0...ARVC-1])
FILENAME name of current input file
FNR input record number in current file
FS input field separator (default blank)
NF number of fields in current input record
NR input record number since beginning
OFMT output format for numbers (default "%.6g")
OFS output field separator (default blank)
ORS output record separator (default newline)
RLENGTH length of string matched by regular expression in match
RS input record separator (default newline)
RSTART beginning position of string matched by match
SUBSEP separator for array subscripts of form [i,j,...] (default ^\)

Escape sequences:
\b backspace (^H)
\f formfeed (^L)
\n newline (DOS, CR/LF; Unix, LF)
\r carriage return
\t tab (^I)
\ddd octal value `ddd', where `ddd' is 1-3 digits, from 0 to 7
\c any other character is a literal, eg, \" for " and \\ for \

Awk string functions:
`r' is a regexp, `s' and `t' are strings, `i' and `n' are integers
`&' in replacement string in SUB or GSUB is replaced by the matched string

gsub(r,s,t) globally replace regex r with string s, applied to data t;
return no. of substitutions; if t is omitted, $0 is used.
gensub(r,s,h,t) replace regex r with string s, on match number h, applied
to data t; if h is 'g', do globally; if t is omitted, $0 is
used. Return the converted pattern, not the no. of changes.
index(s,t) return the index of t in s, or 0 if s does not contain t
length(s) return the length of s
match(s,r) return index of where s matches r, or 0 if there is no
match; set RSTART and RLENGTH
split(s,a,fs) split s into array a on fs, return no. of fields; if fs is
omitted, FS is used in its place
sprintf(fmt,expr-list) return expr-list formatted according to fmt
sub(r,s,t) like gsub but only the first matched substring is replaced
substr(s,i,n) return the n-character substring of s starting at i; if n
is omitted, return the suffix of s starting at i

Arithmetic functions:
atan2(y,x) arctangent of y/x in radians in the range of -ã to ã
cos(x) cosine (angle in radians)
exp(n) exponential eü (n need not be an integer)
int(x) truncate to integer
log(x) natural logarithm
rand() pseudo-random number r, 0 ó r ó 1
sin(x) sine (angle in radians)
sqrt(x) square root
srand(x) set new seed for random number generator; uses time of day
if no x given

[end-of-file]

Er, I forgot where I got this notes. Sorry.

read more...

sed and awk notes

Some useful notes:

Chart of similar operations with sed and awk
--------------------------------------------

string
======

sed "s/from/to/" awk '{sub("from","to"); print}'

sed "s/from/to/g" awk '{gsub("from","to"); print}'

sed "s/from/to/3" awk '{$0=gensub("from","to",3); print}'


regex
=====

sed "s/reg.*$/_&_/" awk '{sub(/reg.*$/, "_&_"); print}'

sed "s/reg[ex]/YY/g" awk '{gsub(/reg[ex]/, "YY"); print}'

sed "s/reg[ex]/ZZ/4" awk '{$0=gensub(/reg[ex]/, "ZZ", 4); print}'


awk variable "var"
==================

sed "s/bang/boom/" awk -v var="bang" '{sub(var,"boom");print}'

sed "s/.*=/equ/5" awk -v var=".*=" '{$0=gensub(var,"equ",5);print}'



DOS variable "XY" with awk variable "z"
=======================================

[DOSPROMPT] C:\path> set xy=bangg*

sed "s/%XY%/boom/" awk -v z="%XY" '{sub(z,"boom"); print}'

sed "s/%XY%/boom/g" awk -v z="%XY" '{gsub(z,"boom"); print}'

sed "s/%XY%/boom/5" awk -v z="%XY" '{$0=gensub(z,"boom",5); print}'


interval expression, \{M,N\}
============================

sed "s/fo\{3,8\}/bar/" awk --re-interval '{sub(/fo{3,8}/, "bar");print}'

sed "s/fo\{3,8\}/bar/g"

awk --re-interval -v a="fo{3,8}" '{gsub(a,"bar");print}'
or
awk --re-interval -v a="fo\{3,8\}" '{gsub(a,"bar");print}'



DOS variable "HI", awk variable "j" with interval expression
============================================================

[DOSPROMPT] C:\path> set hi=Whe\{2,7\}!*

sed "s/%hi%/Zow!/" awk --re-interval -v j="%hi" '{sub(j,"Zow!"); print}'

sed "s/%hi%/Zow!/g" awk --re-interval -v j="%hi" '{gsub(j,"Zow!");print}'

[DOSPROMPT] C:\path> REM ... using a disk file ...
[DOSPROMPT] C:\path> echo {$0=gensub(j,"Zow!",5); print} >myfile.awk

sed "s/%hi%/Zow!/5" awk --re-interval -v j="%hi" -f myfile.awk


--
compiled by Eric Pement
on 03/20/2001 07:11pm

[end-of-file]

Taken from: http://www.student.northpark.edu/pemente/awk/awk_sed.txt

read more...

Monday, July 2, 2007

marriages

Lately, I received a lot of marriage invitations.. yeah of course, it's my friends that are getting married. Here some interesting excerpt of the ym conversation I just had with my friend:

kawanku: weih
kawanku: akad yg betul macam mana?
me: kitorang bukan forensic org bunuh2 org
kawanku: aku terima nikahnya blablaba dengan mas kahwinnya 80 ringgit tunaiiii?
kawanku: camtu ka?
me: ikut tok kadi la
me: lain imam lain akad
kawanku: takde la...korang takkan takde kaki kat mindef ke etc
kawanku: oo
kawanku: imam bagitau dulu cara nak jawab?
me: aah
me: dia bagitau dulu
me:
me: rilek aaaa
kawanku:
kawanku: elek aa ni
me:
me: aku nak letak dlm blog aku la conversation nih
me: hahaha
kawanku: hek ele
kawanku: haha
kawanku: ko ade blog ke weh?
kawanku: haha
kawanku: sial senyap2 tak kasitau
me: ok i'm putting it now



Hehe.

read more...