![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |
| here document to automate perl script that call script | hogger84 | Shell Programming and Scripting | 3 | 10-22-2007 11:15 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 08:05 AM |
| return valuse from child script to parent script | borncrazy | Shell Programming and Scripting | 1 | 08-20-2004 04:39 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need help with my script
Hello all, I am brand new to scripting and need a bit of help on a starter script I am writing. The point of the script is to pull out select information from different lines in a file (based off of current date), and print them out. Right now my output reads like: Code:
Group: BRIAN BRIANWIL Allotted: 13 10 Booked: 8 0 Cancelled: 1 0 But I would like to have it sorted so it would read like: Code:
Group Allotted Booked Cancelled BRIAN 13 8 1 BRIANWIL 10 0 0 My current script looks like: Code:
#!/bin/sh echo "Enter today's date (Ex. 07/26/2006)" read date group=`dbclist bdwwblok.txt:bdw|grep $date| cut -c 1-8` n=`dbclist bdwwblok.txt:bdw|grep $date| cut -c 33-34` m=`dbclist bdwwblok.txt:bdw|grep $date| cut -c 37-38` o=`dbclist bdwwblok.txt:bdw|grep $date| cut -c 47-48` echo "Group: " $group echo "Allotted:" $n echo "Booked: " $m echo "Cancelled:"$o And a sample line from the file I am working with is: Code:
BRIAN 24539431QN 07/26/2006 13 81 10 1 0 Can somebody please tell me what I am doing wrong? I know that it's extremely basic, but I'm just trying to teach myself and get this working. Thanks in advance if somebody can at least point me in the right direction. Last edited by reborg; 07-29-2006 at 07:51 PM.. |
|
||||
|
Nevermind, I got it to work how I wanted it to. The coding goes like this: Code:
groupfix()
{
file="wblok.txt"
type="bdw"
dir="/u/imag10.1/files/bdw/"
echo "Today's date is:" `date`
echo "Enter date needed: (ex. 07/26/2006)"
read date
output=`grep $date $dir$type$file | cut -c1-8,33-34,37-38,47-48 | wc -l`
echo " "
echo "$output groups in hotel today"
echo "Group Information (Group Name, Allotments, Booked, Cancelled)"
for i in $file
do
grep $date $dir$type$file | cut -c1-8,33-34,37-38,47-48
done
return
}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|