04-16-2013
Quote:
That's a quick hack to trim leading and trailing white spaces from the variable.
Did it have leading or trailing white spaces? I didn't see the logic of why it would.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
It is erroring for : binary operator expected on the
if line.
Any suggestions?
Thanks in advence. (7 Replies)
Discussion started by: apps_user
7 Replies
2. UNIX for Advanced & Expert Users
Hi frnds...
I m facing very irritating problem already waisted my 2 days..
I have a following script..( i am pasting only the main code)
ftp -ivn 213.194.40.77 <<FTP
user $user $password
binary
cd $FileDir/out
lcd $localpath
get $file
rename $FileDir/out/$file $FileDir/tmp/$file... (1 Reply)
Discussion started by: clx
1 Replies
3. Shell Programming and Scripting
Within my script, there is this following if, then statement. It basically looks for files in a directory that match a certain naming convention (bingofile*.DAT) and are non empty files and moves these files to a diff. directory. The script works okay if there is only one file matching the search... (4 Replies)
Discussion started by: basisvasis
4 Replies
4. Linux
hi
i'm trying to do program that counts the total no of words from files from a directory and all it's subdirectories.ang i get the binary operator expected error at line 7 and line 12.can you please help me with this as quick as possible?
if test -d $1
then
sum=0
for name in $1/*
do... (2 Replies)
Discussion started by: marian
2 Replies
5. Shell Programming and Scripting
Hello,
I am not sure, where I am missing in the scirpt, I am trying to grep few users from /etc/passwd file and if exists, I added line to echo as user exist, if not create it.
#!/bin/bash
for vid in v707 z307 z496 z163 z292 ; do
if
then
echo " $vid User exists "
else
... (2 Replies)
Discussion started by: bobby320
2 Replies
6. Shell Programming and Scripting
Hello Unix forum.
I'm encountering the following error "binary operator expected error" and I cannot seem to solve the issue.
I have the following source files to process:
CPA_LOOKUP_dat.lst
PROFILE_TXN__dat.lst
TRANSACTION_CODE_dat.lst
PROFILE_TXN_OUT_OF_BALANCE_dat.lst ... (2 Replies)
Discussion started by: pchang
2 Replies
7. Shell Programming and Scripting
Here is line number 59 of my script
59 if ; thenI get the following error at this line.
Can you please explain why ? (1 Reply)
Discussion started by: mohtashims
1 Replies
8. AIX
Hi,
I have a shell script which fetches the MRP status and the LAG status.
When I execute it manually like, sh <script_name>, it fetches the output as expected, but when I schedule through crontab, it's not working as expected.
Any help would be really appreciated.
Here is the code... (3 Replies)
Discussion started by: Nagaraj R
3 Replies
9. UNIX for Beginners Questions & Answers
Hi Team,
I just started to learn shell scripting and i got this script from an online book and tried to run in my terminal. But it throws error message.
echo $0
-bash
echo $UID
501
cat check_rootuser.sh
#!/bin/bash
# Run as root, of course.
LOG_DIR=/var/log
ROOT_UID=0 # Only users... (4 Replies)
Discussion started by: SelvaKumarq
4 Replies
10. Shell Programming and Scripting
Hi,
Below is my code where i m trying to grep for name>$servername in manages*.tmp files
servername="serv1"
set manages*.tmp
if ; then
However, i get the below error at the if condition:
Can you please suggest how can i fix the problem. (3 Replies)
Discussion started by: mohtashims
3 Replies
textutil::trim(n) Text and string utilities, macro processing textutil::trim(n)
__________________________________________________________________________________________________________________________________________________
NAME
textutil::trim - Procedures to trim strings
SYNOPSIS
package require Tcl 8.2
package require textutil::trim ?0.7?
::textutil::trim::trim string ?regexp?
::textutil::trim::trimleft string ?regexp?
::textutil::trim::trimright string ?regexp?
::textutil::trim::trimPrefix string prefix
::textutil::trim::trimEmptyHeading string
_________________________________________________________________
DESCRIPTION
The package textutil::trim provides commands that trim strings using arbitrary regular expressions.
The complete set of procedures is described below.
::textutil::trim::trim string ?regexp?
Remove in string any leading and trailing substring according to the regular expression regexp and return the result as a new
string. This is done for all lines in the string, that is any substring between 2 newline chars, or between the beginning of the
string and a newline, or between a newline and the end of the string, or, if the string contain no newline, between the beginning
and the end of the string. The regular expression regexp defaults to "[ \t]+".
::textutil::trim::trimleft string ?regexp?
Remove in string any leading substring according to the regular expression regexp and return the result as a new string. This apply
on any line in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or
between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string.
The regular expression regexp defaults to "[ \t]+".
::textutil::trim::trimright string ?regexp?
Remove in string any trailing substring according to the regular expression regexp and return the result as a new string. This apply
on any line in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or
between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string.
The regular expression regexp defaults to "[ \t]+".
::textutil::trim::trimPrefix string prefix
Removes the prefix from the beginning of string and returns the result. The string is left unchanged if it doesn't have prefix at
its beginning.
::textutil::trim::trimEmptyHeading string
Looks for empty lines (including lines consisting of only whitespace) at the beginning of the string and removes it. The modified
string is returned as the result of the command.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category textutil
of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for
either package and/or documentation.
SEE ALSO
regexp(n), split(n), string(n)
KEYWORDS
prefix, regular expression, string, trimming
CATEGORY
Text processing
textutil 0.7 textutil::trim(n)