nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

need help on shell scripting

This is a discussion on need help on shell scripting within the Shell scripting forums, part of the Development/Scripting category; Hi friends, this is my first mail you all. i need to write a shell script which will check a ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 11-06-2007, 02:11 PM
Junior Member
User
 
Join Date: Nov 2007
My distro: RHEL
Posts: 1
Rep Power: 0
rahul_sayz is on a distinguished road
Default need help on shell scripting

Hi friends,

this is my first mail you all.
i need to write a shell script which will check a directory /home/foo/work to find work3x.3.5.32.29.STARTED, this directory has lot of files with prefix .STARTED. the file may be of any name.

the script will search all the files ending with .STARTED, and will print in a format: work3x 3.5.32.29 as an example.

thanks & Regards

Rahul
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-08-2007, 11:37 AM
anilvrathod's Avatar
Junior Member
User
 
Join Date: Dec 2007
Location: Pune
My distro: Red Hat
Posts: 13
Rep Power: 0
anilvrathod is on a distinguished road
Arrow

Dear Frien following script will help you to solve problem

clear
path=/home/foo/work
cd $path
DISPLAY=`ls -al | grep ".STARTED" |wc -l`
if [ $DISPLAY = "0" ]
then
echo "There is no *.STARTED Files"
else
echo
until [ $DISPLAY -lt "0" ]
do
SHOW=` ls -al | grep ".STARTED" | awk {'print $9'} | head -$DISPLAY | tail -1 `
echo $SHOW
DISPLAY=`expr $DISPLAY - 1 `
done
fi

Anil v. Rathod
Linux System Administrator
Kalinga Data Link Pvt.Ltd,Pune
Cell 9860062917
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
shell scripting + send mail with header ephdia Shell scripting 0 11-27-2007 12:29 PM
shell scripting by todd meadors bashamsc Shell scripting 2 11-12-2007 07:28 PM
looking for good shell scripting tutorial.... milonix Shell scripting 4 04-24-2007 07:44 AM
Books on Shell-Scripting shankar100 Shell scripting 3 02-16-2007 02:19 PM
Learning Shell Scripting ricc Shell scripting 4 08-30-2005 10:37 AM


All times are GMT +5.5. The time now is 07:53 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36