06-13-2005
My guess:
TOT_HD=`cat $i | grep "HD" | cut -c17-25`
is sometimes set to 4 lines worth of stuff. There are some "HD"'s that you were not expecting.
Try:
TOT_HD=`cat $i | grep "HD" | head -1 | cut -c17-25`
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I have a script which calls a sqlplus command and i'm saving the output in a variable.
Z=`sqlplus -s $TC_ORACLE_USER/$TC_ORACLE_PASSWORD@$TC_CONNECT_STRING <<eof
set echo off
set head off
set serveroutput on;
set feedback off;
select description from period
where trunc(sysdate)... (2 Replies)
Discussion started by: decci_7
2 Replies
2. Shell Programming and Scripting
Hi all,
I want to get show an entire line of a output on the behalf of a single character. Hope, its easy but not for me. I am giving an example of my task:
-rw-r--r-- 1 dtiwari_x mkpasswd 0 Dec 30 19:02 =5
-rw-r--r-- 1 dtiwari_x mkpasswd 61952 Jan 7 18:32 Customizing the... (3 Replies)
Discussion started by: naw_deepak
3 Replies
3. UNIX for Dummies Questions & Answers
I'm not sure if the problem I'm seeing is an artifact of sed or simply a beginner's mistake. Here's the problem: I want to add a zero-width space following each underscore between XML tags. For example, if I had the following xml:
<MY_BIG_TAG>This_is_a_test</MY_BIG_TAG>
It should look like... (8 Replies)
Discussion started by: rhetoric101
8 Replies
4. Shell Programming and Scripting
Hi All,
I am facing some problems with bad characters in my file.For example-
00000000509 TCI DEVOFFERS= 1
Now I want to remove all bad characters and replace with *.
Please suggest some solution.
Along with that How to mention a range of ASCII values in TR command to replace?
... (2 Replies)
Discussion started by: bghosh
2 Replies
5. UNIX for Dummies Questions & Answers
Hi All,
I am fetching oracle query result in shell variable. As columns numbers are more the output wraps in unix terminal .i.e one complete record in db gets store in multiple lines. with each line ends with $ character. I want to remove these unnecessary $ character but to keep required $... (8 Replies)
Discussion started by: Harshal22
8 Replies
6. Shell Programming and Scripting
Hello,
I was trying to split a string to characters by perl oneliner.
echo "The quick brown fox jumps over the lazy dog" | perl -e 'split // ' But did not work as with bash script pipe:
echo "The quick brown fox jumps over the lazy dog" | fold -w1 | sort | uniq -ic 8
1 T
1... (6 Replies)
Discussion started by: yifangt
6 Replies
7. UNIX for Dummies Questions & Answers
RedHat Linux 5.8/Korn Shell
I have text file name /etc/oracle/config.loc. It has the following text
#Device/file getting replaced by device +OCR
ocrconfig_loc=+DATA
ocrmirrorconfig_loc=+OCRBut , when I open this file using cat , the PS1 character (for prompt) appears as the last character... (8 Replies)
Discussion started by: omega3
8 Replies
8. Shell Programming and Scripting
Input file:
3420023_3422482,3422486_3423070 46910
1795263_1798343 32681
1837399_1838886 1534
2148674_2149696,2149698_2149772 10203
3825382_3825555,3827296_3827900 198
1839890_1840294 72
.
.
Output file
3420023_3422482,3422486_3423070 3420023_3422482,3422486_3423070 46910
1795263... (1 Reply)
Discussion started by: perl_beginner
1 Replies
9. UNIX for Beginners Questions & Answers
I'm trying to write a script that will email the contents of my Application folder to me.
cd /Applications
ListApps=$(ls)
echo $ListApps | mail -s "Application Check" myself@myemail.com
This sends it in a paragraphed block i.e:
Adobe Acrobat Reader.app App Store.app Atom.app... (4 Replies)
Discussion started by: $shell_Learner
4 Replies
10. Shell Programming and Scripting
i have a datafile (data.txt) that has the following data:
#Beginner`echo... (4 Replies)
Discussion started by: SkySmart
4 Replies
LEARN ABOUT ULTRIX
escape
escape(1) Mail Avenger 0.8.3 escape(1)
NAME
escape - escape shell special characters in a string
SYNOPSIS
escape string
DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result.
EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string:
$ var='; echo gotcha!'
$ eval echo hi $var
hi
gotcha!
$
Using escape, one can avoid executing the contents of $var:
$ eval echo hi `escape "$var"`
hi ; echo gotcha!
$
A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For
example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient:
#!/bin/sh
formail -x to -x cc -x resent-to -x resent-cc
| fgrep "$1" > /dev/null
&& exit 0
echo "<$1>.. address does not accept blind carbon copies"
exit 100
To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt
script:
bodytest reject_bcc `escape "$RECIPIENT"`
SEE ALSO
avenger(1),
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 escape(1)