Hi you're right, I'm not getting a simple integer readout. I'm getting this:
I am extremely unfamiliar with the awk command and haven't been able to find a tutorial that makes much sense to me yet. Can anyone help me out with isolating the integer so that it can be compared? I know its a simple string isolation but I can't figure out how to do it. Or is there an easier way to only get the number?
Hi I am new to shell script programming...
want to know the process of the following:
if
then
echo "$0: missing argument for option(s) :$MISSINGOPTARG"
echo "usage" $USAGE"
exit 1
fi (1 Reply)
Hi All,
Has been a while since I was last on, so I hope everyone has been doing fine. ;)
Would like to know if the below IF statement syntax is correct for a ksh environment. It's been pushed into live as someone had deleted the development copy(!); not withstanding that, the statement now... (3 Replies)
Hi,
Can you please help me with this one: I write an "if" statement, something like this:
if
then
echo "big file"
else
echo "normal file"
and I get an error: `'then is not expected
Thanks in advance (6 Replies)
I'm working on a function in a shell script I'm writing that will eventually take in and print out a list of vendor names and aliases (for my work) Here's the function in question:
addvendorandalias ()
{
echo
echo -n 'Would you like to create a new vendor list (y or n)? '
read answer... (3 Replies)
It saves me lot of typing and space/lines when I do not use full 'if' keyword and construct, instead use ..
&& <statement> || <statement>
that perfectly replaces..
if ; then
<statement>
else
<statement>
fi
Can I use following syntax when I want to add multiple statements under 'if'... (4 Replies)
Hi,
Is there a way to compare the value in if condition with a list of values.
eg . if ]
then
echo "it's a mammal"
else
echo "its not"
fi
Thanks! (8 Replies)
Hi
Can you please tell me what is wrong with this line:
if && ]; then
basically i want to check if x = 12 and F (Filename) end with 'g'. But it is throwing syntax error. (7 Replies)
I am getting the following error when I am running a script in ksh when trying to execute an if statement comparing two numerical values
tstmb.sh: 1.5321e+08: 0403-057 Syntax error
Below is my code snippet.
#!/bin/ksh
set -x
TODAY=$(date +%y%m%d)
for file in $(ls -rt *.log | tail... (11 Replies)
I want to make the file test condition a variable ($Prmshn in code below).
My goal is to use something like the first three unsuccessful if statetments since the 'if
#!/bin/ksh
test_input()
{
Prmshn=${1}
InFLNm=${2}
ifReq="-$Prmshn $InFLNm"
#the following three if statments fail:
#if ] ;... (10 Replies)
I'm new to unix and the command line and am trying to learn different commands. I have a file (teledir.txt) that contains a name and phone number for 3 different people. I am writing a script that is to take two positional parameters and I typed out how it should behave:
if <name and number... (1 Reply)
Discussion started by: Eric7giants
1 Replies
LEARN ABOUT DEBIAN
file::find::wanted
Wanted(3pm) User Contributed Perl Documentation Wanted(3pm)NAME
File::Find::Wanted - More obvious wrapper around File::Find
VERSION
Version 1.00
SYNOPSIS
File::Find is a great module, except that it doesn't actually find anything. Its "find()" function walks a directory tree and calls a
callback function. Unfortunately, the callback function is deceptively called "wanted", which implies that it should return a boolean
saying whether you want the file. That's not how it works.
Most of the time you call "find()", you just want to build a list of files. There are other modules that do this for you, most notably
Richard Clamp's great File::Find::Rule, but in many cases, it's overkill, and you need to learn a new syntax.
With the "find_wanted" function, you supply a callback sub and a list of starting directories, but the sub actually should return a boolean
saying whether you want the file in your list or not.
To get a list of all files ending in .jpg:
my @files = find_wanted( sub { -f && /.jpg$/ }, $dir );
For a list of all directories that are not CVS or .svn:
my @files = find_wanted( sub { -d && !/^(CVS|.svn)$/ }, $dir ) );
It's easy, direct, and simple.
WHY DO THIS ?
The cynical may say "that's just the same as doing this":
my @files;
find( sub { push @files, $File::Find::name if -f && /.jpg$/ }, $dir );
Sure it is, but File::Find::Wanted makes it more obvious, and saves a line of code. That's worth it to me. I'd like it if find_wanted()
made its way into the File::Find distro, but for now, this will do.
FUNCTIONS
find_wanted( &wanted, @directories )
Descends through @directories, calling the wanted function as it finds each file. The function returns a list of all the files and
directories for which the wanted function returned a true value.
This is just a wrapper around "File::Find::find()". See File::Find for details on how to modify its behavior.
COPYRIGHT & LICENSE
Copyright 2005-2012 Andy Lester.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0.
perl v5.14.2 2012-06-08 Wanted(3pm)