Sponsored Content
Top Forums Shell Programming and Scripting Help with Script using Command Blocks Post 302380423 by Alexis Duarte on Tuesday 15th of December 2009 06:26:45 AM
Old 12-15-2009
Error Help with Script using Command Blocks

Hello,
I am trying to create a shell script that use command block (don´t really know if this is the correct way to say it), but while one version works fine, the other one is not working at all.
So let me show an example of this "command block" I´m using and its working ok:
Code:
cat << _EOF_
`echo "All informations regarding Brand Split log. It is in order regardless it shows no date."`
`echo`
`echo "Activations:"`
`grep "^8:Mass40s --" brand_split_file`
`grep "^9:Mass --" brand_split_file`
`grep "^10:Mass Promo --" brand_split_file`
`grep "^11:Jovem --" brand_split_file`
`grep "^12:Corporate --" brand_split_file`
`grep "^13:VIP --" brand_split_file`
_EOF_

This next one is not working:
Code:
monday=`awk -F";" '{print$1}' tmp |sort -u |tail -7 |head -1`

echo $monday
cat << _EOF_
`echo "Deletion by SC on $monday"`
`echo "Mass40s : `awk -F";" '$1=="'$monday'" && $4==44' tmp |wc -l`"`
`echo "Mass : `awk -F";" '$1=="'$monday'" && $4==4' tmp |wc -l`"`
`echo "Mass Promo : `awk -F";" '$1=="'$monday'" && $4==3' tmp |wc -l`"`
`echo "Jovem : `awk -F";" '$1=="'$monday'" && $4==42' tmp |wc -l`"`
`echo "Corporate : `awk -F";" '$1=="'$monday'" && $4==6' tmp |wc -l`"`
`echo "VIP : `awk -F";" '$1=="'$monday'" && $4==5' tmp |wc -l`"`
`echo "Prestigio : `awk -F";" '$1=="'$monday'" && $4==48' tmp |wc -l`"`
`echo "Reactivation : `awk -F";" '$1=="'$monday'" && $4==46' tmp |wc -l`"`
`echo "Postpaid : `awk -F";" '$1=="'$monday'" && $4==1' tmp |wc -l`"`
`echo "T+ Employee : `awk -F";" '$1=="'$monday'" && $4==10' tmp |wc -l`"`
`echo "Stock : `awk -F";" '$1=="'$monday'" && $4==18' tmp |wc -l`"`
`echo "Paris : `awk -F";" '$1=="'$monday'" && $4==40' tmp |wc -l`"`
`echo "Boston : `awk -F";" '$1=="'$monday'" && $4==41' tmp |wc -l`"`
`echo "Sal : `awk -F";" '$1=="'$monday'" && $4==43' tmp |wc -l`"`
`echo "TC101 : `awk -F";" '$1=="'$monday'" && $4==101' tmp |wc -l`"`
`echo "TC102 : `awk -F";" '$1=="'$monday'" && $4==102' tmp |wc -l`"`
`echo "TC106 : `awk -F";" '$1=="'$monday'" && $4==106' tmp |wc -l`"`
_EOF_

This is the error output:
Code:
./the_script: command substitution: line 1: unexpected EOF while looking for matching `"'
./the_script: command substitution: line 2: syntax error: unexpected end of file
./the_script: command substitution: line 1: unexpected EOF while looking for matching `"'
./the_script: command substitution: line 2: syntax error: unexpected end of file

If you compare the two codes you will notice that while the first code has only one command ( grep ), the second has two ( echo first, and then awk ), so I´m guessing that is the problem... which is strange because if I use the `caracters` it is supose to accecpt it like a command. I have others scripts that use this.

So if you could give me a hint on how to solve this, I would be very gratefull. I'm kind on a hurry, since I making a series of script to run automatically during my well earned vacations.... (about to go crazy with all this work!)

Thank you guys!Smilie
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ls -l (without showing total blocks)

Is it possible to use the ls command and NOT see the total blocks? For example, instead of seeing this... $ ls -l total 16 drwxr-xr-x 2 voicem voicem 4096 Dec 3 09:19 directory1 drwxr-xr-x 2 voicem voicem 4096 Dec 1 01:29 directory2 drwxr-xr-x 2 voicem voicem 4096 Dec 2 00:47 directory3... (5 Replies)
Discussion started by: cdunavent
5 Replies

2. UNIX for Dummies Questions & Answers

Convert 512-blocks to 4k blocks

I'm Unix. I'm looking at "df" on Unix now and below is an example. It's lists the filesystems out in 512-blocks, I need this in 4k blocks. Is there a way to do this in Unix or do I manually convert and how? So for container 1 there is 7,340,032 in size in 512-blocks. What would the 4k block be... (2 Replies)
Discussion started by: rockycj
2 Replies

3. Shell Programming and Scripting

how to split this file into blocks and then send these blocks as input to the tool called Yices?

Hello, I have a file like this: FILE.TXT: (define argc :: int) (assert ( > argc 1)) (assert ( = argc 1)) <check> # (define c :: float) (assert ( > c 0)) (assert ( = c 0)) <check> # now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as... (5 Replies)
Discussion started by: paramad
5 Replies

4. UNIX for Dummies Questions & Answers

Command rm deletes filename but not the blocks

Hi It happens when I try to delete a file of 250MB with the command rm -r on our old Intergraph CLIX that the filename disappears while the blocks remain on the machine. Only when I reboot the system the blocks really disappear. Then rm works again for sometime but after some time it happens... (15 Replies)
Discussion started by: hausi2012
15 Replies

5. Shell Programming and Scripting

Dividing tab blocks in bash script

Hi everyone, I have a data.xml file which only contains thousands of data (tag) blocks. A part of the file looks exactly like this; <data> Line Line Line </data> <data> Line Line Line </data> the rest of the file is simply a repetition of this part. Here each data block contains a... (8 Replies)
Discussion started by: hayreter
8 Replies

6. Shell Programming and Scripting

Row blocks to column blocks

Hello, Searched for a while and found some "line-to-column" script. My case is similar but with multiple fields each row: S02 Length Per S02 7043 3.864 S02 54477 29.89 S02 104841 57.52 S03 Length Per S03 1150 0.835 S03 1321 0.96 S03 ... (9 Replies)
Discussion started by: yifangt
9 Replies

7. Shell Programming and Scripting

Blocks into table

please help, I have a huge file with blocks of data which I need to convert to a tabular format. Input sample id: GO:0000017 name: alpha-glucoside transport namespace: biological_process def: "The directed movement of alpha-glucosides into, out of or within a cell, or between... (3 Replies)
Discussion started by: ritakadm
3 Replies

8. Shell Programming and Scripting

Shell Script Comment code blocks in a bash source file

Just began to learn on Shell Script. I got an exercise from my friend. I know how to make this happen in C, but I'm not familiar with Shell Script. Hope I can get some help from all of you. I want to write a bash script to comment code blocks in a bash source file. What I mean comment is '#', I... (1 Reply)
Discussion started by: HiFuture0801
1 Replies

9. Solaris

Can I run repair on lot of blocks with single command ?

Hi, I have Solaris-10 OS on T5220. Both local disks were mirrored under SVM. Somehow when one disk gone bad (c0t1d0), other disk (c0t0d0) also got lot of bad block. We have readable data only on c0t0d0, but as soon as server comes after, it hangs when I run few commands because of read errors,... (1 Reply)
Discussion started by: solaris_1977
1 Replies
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy