Try this:
open(FILE, "/home/file.txt") or die "Can't open file\n";
while(<FILE>){
if (/(\d+)\s+(\w+).+?$/){
print "$1\t$2\n";
}
}
This implies that your line have numbers, then a space, then a word, then anything
else, and you just want the numbers, then a tab, then the word.
-----Original Message-----
From: Chang Ming Huei [mailto:[EMAIL PROTECTED]]
Sent: Sun 6/2/2002 9:10 AM
To: [EMAIL PROTECTED]
Cc:
Subject: about awk 2 perl
Hi all:
I want to use perl to do something like a awk script as following:
cat file.txt | awk '{print $1,$2}'
How can I do it ?