- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: using tail -f in a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2002 05:55 AM
тАО10-23-2002 05:55 AM
Re: using tail -f in a script
What about,for example
tail -50 /var/adm/syslog/syslog.log > /tmp/robert.
regards,
Hamdy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2002 05:57 AM
тАО10-23-2002 05:57 AM
Re: using tail -f in a script
My example is messed up. I can't write shell scripts until I get enough caffeine into my system!
Christian's awk example will do the job.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2002 06:11 AM
тАО10-23-2002 06:11 AM
Solutionsounds strange. I have just tried this:
1) created a logfile
# touch /tmp/dunavent
2) made the script dunavent.sh with this content:
#!/usr/bin/sh
LOGFILE=/tmp/dunavent
tail -1f $LOGFILE | while read line
do
echo $line | grep e
if [ "$?" = "0" ]
then
# found
echo $line >>./log_Y
fi
done
3) executed dunavent.sh in the background:
# dunavent.sh &
4) added lines to /tmp/dunavent
# echo "ee and e" >>/tmp/dunavent
And all lines containing "e" are added to log_Y
(!?)
How did you do it?
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2002 06:34 AM
тАО10-23-2002 06:34 AM
Re: using tail -f in a script
Here is a shell which does it without a daemon :
#!/usr/bin/sh
tail -f log_X |&
NPID=$!
while :
do
read -p VAR
echo $VAR | grep n > log || continue
kill $!
break
done
cat log
Regards,
Jean-Louis.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-24-2002 08:50 AM
тАО10-24-2002 08:50 AM
Re: using tail -f in a script
Your script did the trick for me!!! Thanks!!
-cd
- « Previous
-
- 1
- 2
- Next »