•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,442 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,626 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1347 | Replies: 0
![]() |
•
•
Join Date: Aug 2007
Posts: 27
Reputation:
Rep Power: 2
Solved Threads: 0
Hi Script Masters
Im new to scripting and having trouble to get this script to work. Basically i want my script to look for files within this directory
/apps/gnp/prd/asia/geacssm/ssr/GNPP02/var/ft/backup/
I have put all the files i want to look for in the above directory in a txt file, example of what the files look like:
ledg_ofssgi_02
they normally have a date stamp beside like this ledg_ofssgi_02.3008
This means the file for the 30th August, but because i want to run this script daily , i need to use the date command.
To look for the files i would normally take a file at a time and go into the directory and do ls-ltr *ledg_ofssgi_02.3008* to see if its there
Im trying to use variables, but i just cant get my head round it
(
#!/bin/ksh
set - x
PATH="/apps/gnp/prd/asia/geacssm/ssr/GNPP02/var/ft/backup/"
DST='date +%d%m*'
LIST='ls -ltr'
FEEDS=/export/home/u820052/files.txt
cat $FEEDS | while read listval
do
fed=`echo $listval`
dpath=`cd ${PATH}/${LIST}
I just cant get pass the 1st line cat $FEEDS wont work saying cat is not found.
I can get some of it working doing this instead
cd /apps/gnp/prd/asia/geacssm/ssr/GNPP02/var/ft/backup/
ls -ltr > /export/home/u820052/feed.txt
cat $FEED | nawk ' { print $6,$7,$8,$9 }' |
But then i need to see if my files with todays date is in the directory. i need to add it in somewhere
Im a confuzed and fedup script begineer needing some help and explanation on what im doing wrong.
Im new to scripting and having trouble to get this script to work. Basically i want my script to look for files within this directory
/apps/gnp/prd/asia/geacssm/ssr/GNPP02/var/ft/backup/
I have put all the files i want to look for in the above directory in a txt file, example of what the files look like:
ledg_ofssgi_02
they normally have a date stamp beside like this ledg_ofssgi_02.3008
This means the file for the 30th August, but because i want to run this script daily , i need to use the date command.
To look for the files i would normally take a file at a time and go into the directory and do ls-ltr *ledg_ofssgi_02.3008* to see if its there
Im trying to use variables, but i just cant get my head round it
(#!/bin/ksh
set - x
PATH="/apps/gnp/prd/asia/geacssm/ssr/GNPP02/var/ft/backup/"
DST='date +%d%m*'
LIST='ls -ltr'
FEEDS=/export/home/u820052/files.txt
cat $FEEDS | while read listval
do
fed=`echo $listval`
dpath=`cd ${PATH}/${LIST}
I just cant get pass the 1st line cat $FEEDS wont work saying cat is not found.
I can get some of it working doing this instead
cd /apps/gnp/prd/asia/geacssm/ssr/GNPP02/var/ft/backup/
ls -ltr > /export/home/u820052/feed.txt
cat $FEED | nawk ' { print $6,$7,$8,$9 }' |
But then i need to see if my files with todays date is in the directory. i need to add it in somewhere
Im a confuzed and fedup script begineer needing some help and explanation on what im doing wrong.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Shell Script to Zip / FTP / Delete transactional files. (Shell Scripting)
- For Pay Shell Script - Zip / FTP / Delete transactional files (Shell Scripting)
- Korn Shell Script for deleting files older than 2 months (Shell Scripting)
- c++ or shell script to delete some files (C++)
- How to delete files in UNIX using shell script (Shell Scripting)
- Problem with variables in Windows shell script (Windows NT / 2000 / XP / 2003)
Other Threads in the Shell Scripting Forum
- Previous Thread: Check if process is running
- Next Thread: capturing line from script output and appending to a file


Linear Mode