Solved

I need a regular expression

Posted on 2004-04-30
2
230 Views
Last Modified: 2010-04-21
Hi!

i've got this line stored in a perl variable named $size:

4       /mail/lalalala.net/wbiz100332-m92

I want to keep only first number, this number can have from 1 to 4 digits (it's size in Kb)... what regular expressions can i use for this?

Thanks in advance!
0
Comment
Question by:morsa801tons
2 Comments
 
LVL 6

Expert Comment

by:bira
Comment Utility
echo $size |cut -c1-4
0
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 125 total points
Comment Utility
$size ~= /^(\d+) /;
my $fubar = $1;

or

$size ~= s/ .*//;
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now