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
тАО05-02-2004 09:59 PM
тАО05-02-2004 09:59 PM
Can anyone help me to modify my script? I just want to get rid of single quote from Name columns. How can i use sed,tr from within printf statement? Or else there may be other way.
Below is my script.
#!/bin/sh
DIR="/home/tapas/"
DT=`date +%d`
DT=`expr $DT - 1`
DTCT=`echo $DT|wc -m`
FL="logfile.20040429"
ll $DIR/$FL > /dev/null
RFL="report`date +%Y%m$DT`.xls"
echo "TIME\t\tNAME\t\tFROM\t\tVIA">$RFL
grep -e "- OK --" $FL|awk '
{
if ( $9 == "via" )
{
printf $4"\t"$8"\t"$12"\t"$10"\n"
}
else
{
printf $4"\t"$8"\t"$10"\n"
}
}
'>>$RFL
Below is the logfile.
Thu Apr 29 07:43:16 2004: created by PID 5173 Version 5.1.1A AAA_POLL BINARY_AATV CHK_COUNTS CHK_SHELLS CHK_TOKEN EMAIL LAS = 1.7.1 (NO-HGAS) Y2K up since Sun Apr 25 07:59:11 2004
Thu Apr 29 07:43:16 2004: fsmid check+las-logall-1.0; hostname bombay; dns-name bombay.abc.com
Thu Apr 29 07:43:16 2004: Switched from '/var/opt/aaa/logs/logfile.20040428' to
'/var/opt/aaa/logs/logfile.20040429'
Thu Apr 29 07:43:16 2004: Received-Authentication: 2/294 'tapas' via a.b.c.d
from d.e.f.g port 133 PPP
Thu Apr 29 07:43:16 2004: find_auth_ent: no default authfile data structure
Thu Apr 29 07:43:16 2004: Authentication: 2/294 'tapas' via a.b.c.d from
d.e.f.g port 133 PPP - OK -- total 0, holding 0
Thu Apr 29 07:43:16 2004: created by PID 5173 Version 5.1.1A AAA_POLL BINARY_AATV CHK_COUNTS CHK_SHELLS CHK_TOKEN EMAIL LAS = 1.7.1 (NO-HGAS) Y2K up since Sun Apr 25 07:59:11 2004
Thu Apr 29 07:43:16 2004: fsmid check+las-logall-1.0; hostname bombay; dns-name bombay.abc.com
Output is like below. But instead of 'tapas' i want tapas( Not any quatation)
TIME NAME FROM VIA
07:43:16 'tapas' d.e.f.g a.b.c.d
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2004 10:15 PM
тАО05-02-2004 10:15 PM
Re: awk help
|tr -d \'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2004 10:33 PM
тАО05-02-2004 10:33 PM
Re: awk help
regsub("'","",$8)
in your awk script.
regsub makes a substitution in your script.
check manual 'cause awk changes between various unix flavours.
Peace, R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2004 11:33 PM
тАО05-02-2004 11:33 PM
Re: awk help
Can u tell me where exactly insert tr or regsub/gsub in my script? I understand this is a simple thing but i am not able to solve right now.
Rgds
Tapas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2004 11:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2004 12:07 AM
тАО05-03-2004 12:07 AM
Re: awk help
I was not able to solve this simple problem. Actually in one of my earlier script
i had solution similar to yours. Thanx a lot.
Rgds
Tapas