nixCraft Linux Forum

nixCraft

Linux / UNIX 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

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2007, 01:11 PM
Junior Member
User
 
Join Date: Nov 2007
OS: RHEL
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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
  #2 (permalink)  
Old 08-12-2007, 10:37 AM
anilvrathod's Avatar
Junior Member
User
 
Join Date: Dec 2007
Location: Pune
OS: Red Hat
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
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


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 Off


Similar Threads

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


All times are GMT +5.5. The time now is 04:16 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

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 37 38