12-07-2013
Yoda is right, there are better ways to achieve what you want, but setting IFS to "," and getting the cut command right will make your code snippet fly.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Have the following lines in a script: echo "-----------------------------------------------"\
"---------------------" >> $xdfrpt
echo "- Date - - / - /stand - /u - /u1 - /u2 -"\
"/x1 - /x2 - /x3 -" >> $xdfrpt
echo... (1 Reply)
Discussion started by: Cameron
1 Replies
2. Shell Programming and Scripting
Hi,
I have given the following statement in a script to put the values of variables (VAR1, VAR2,...) in a file.
echo " $VAR1 $VAR2 $VAR3 $VAR4 $VAR5" >> filename
But the output is not coming properly. Variables VAR5, VAR4 are replacing the first (VAR1, VAR2,..). I can't... (5 Replies)
Discussion started by: abrd600
5 Replies
3. Shell Programming and Scripting
echo "XXXXX" >> /xx/output.txt
cat /xx/file.txt| awk '{tony=tony+$1+$2; print tony/$3*100}' >> /xx/output.txt
Dear all,
In this situation i will have 2 lines in the output file. What i want is to have only one output line. e.g: XXXXX "value"
HOW to put the output of the "cat and awk" in... (1 Reply)
Discussion started by: tontal
1 Replies
4. UNIX for Dummies Questions & Answers
Hi
I am using tcsh.
I want display in a file_1 like this.
$VARIBALE
I gave in a termianl
> echo "\$VARIBALE" > file_1
Its not workning.
It was giving VARIBALE: Undefined variable.
I gave \ before $, but why it was giving undefined varible?
Please help me.
Thanks in advance (4 Replies)
Discussion started by: chaitubek
4 Replies
5. Shell Programming and Scripting
Hi All,
Hope someone can advise here as I have been struggling to find a syntax that works here. I have tried a stack of combination I have seed in the forums but I think because I have needed to use "" and `` in the statments another method is found.
I am reading in lines with the following... (1 Reply)
Discussion started by: nkwilliams
1 Replies
6. Shell Programming and Scripting
Hello all,
Please help with the below.
I have a requirement where in I have to read a pattern and print it as shown below.
Patterns will be as below.
Input Output
Pattern Should be printed as below with spaces such that I can awk.
-*--* - * - - *
*--**... (2 Replies)
Discussion started by: tenderfoot
2 Replies
7. Shell Programming and Scripting
I am new to the c shell script, can you let me know why the set rr= is not working.
C shell script
#! /bin/csh
Set tt= 12345_UMR_BH452_3_2.txt
set rr='echo $tt | cut –d”_” -f1'
syntax error (4 Replies)
Discussion started by: jdsignature88
4 Replies
8. Shell Programming and Scripting
Hi,
I am cutting data from a fixed length test file and then writing out a new record using the echo command, the problem I have is how to stop multiple spaces from being written to the output file as a single space.
Example:
cat filea | while read line
do
field1=`echo $line | cut -c1-2`
... (6 Replies)
Discussion started by: dc18
6 Replies
9. Shell Programming and Scripting
hi all
i have little problem below is my shell script
a=`sqlplus fss_cst/fss_cst@dolp1 << EOF
SET PAGESIZE 0 FEEDBACK OFF TRIMOUT ON;
select process from lfs$ta_process where valid_to_dat=to_date('9/16/2010','mm/dd/yyyy');
EOF`
echo ${SQL}
the script name is test2.sh
when i execute... (5 Replies)
Discussion started by: aishsimplesweet
5 Replies
10. Shell Programming and Scripting
Hey all! I'm in an intro to UNIX class at university, and we've just began writing scripts. Naturally I can't get it to do what I want.
Basic script as follows:
COMPARE1=`ls|wc -l`
tar czf archive.tgz ~/path/to/file
COMPARE2=`tar tvzf archive.tgz|wc -l`
if
then
... (7 Replies)
Discussion started by: nickzourdos
7 Replies