•
•
•
•
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,427 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,584 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: 1696 | Replies: 1
![]() |
•
•
Join Date: Jan 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
hi experts,
i'm new on scripting on sun solaris 8 sparc, need some advices. i have some data in a file like :
20061221 163826.485 20061221 163925.144 058.659 6123456789012 00000E8A 047 08 002 465 00010022 510105642138069
20061221 163915.163 20061221 163925.336 010.173 6123456789012 00000F4F 037 02 002 999 00010022 510103242202784
20061221 163852.363 20061221 163925.549 033.186 6123456789012 00000EED 040 06 002 999 00010022 510105832049518
20061221 163803.035 20061221 163925.708 082.673 6123456789012 00000E26 010 08 002 800 00010022 510105732551708
20061221 163921.293 20061221 163925.787 004.494 6123456789012 00000F6C 039 02 002 999 00008001 510105642169788
20061221 163650.185 20061221 163926.027 155.842 6123456789012 00000D16 051 08 002 465 00008001 510105732672986
20061221 163923.325 20061221 163926.381 003.056 6123456789012 00000F75 062 02 002 123 00008001 510103342614669
example of the data :
20061221 163923.325 20061221 163926.381 003.056 6123456789012 00000F75 062 02 002 123 00008001 510103342614669
underline is shortcode and bold is causes code
the filename is in date format like "2006122001.TDR" and the file generated each hour like 2006122002.TDR,2006122003.TDR,etc. the file log found at /log/TDR/
--> i want to check into the file (e.g. 2006122000.TDR) line by line and get how much shortcode having causes code "00008001".
--> generate it into a file (e.g. 2006122000.log) per hour the info which shortcode having cause code "00008001"
--> count per shortcode how much each short code having causes code "00008001". (e.g. 123 count 20, 465 count 30,etc)
--> send it through sms using syntax : msggen msggen_SMClient.txt 1 "[01234356789]" "[Result of counted data]"
--> the script will running in background and check for the previous hour log file
please advices help to build simple script for this case
Thank you so much
Regards,
bucci
i'm new on scripting on sun solaris 8 sparc, need some advices. i have some data in a file like :
20061221 163826.485 20061221 163925.144 058.659 6123456789012 00000E8A 047 08 002 465 00010022 510105642138069
20061221 163915.163 20061221 163925.336 010.173 6123456789012 00000F4F 037 02 002 999 00010022 510103242202784
20061221 163852.363 20061221 163925.549 033.186 6123456789012 00000EED 040 06 002 999 00010022 510105832049518
20061221 163803.035 20061221 163925.708 082.673 6123456789012 00000E26 010 08 002 800 00010022 510105732551708
20061221 163921.293 20061221 163925.787 004.494 6123456789012 00000F6C 039 02 002 999 00008001 510105642169788
20061221 163650.185 20061221 163926.027 155.842 6123456789012 00000D16 051 08 002 465 00008001 510105732672986
20061221 163923.325 20061221 163926.381 003.056 6123456789012 00000F75 062 02 002 123 00008001 510103342614669
example of the data :
20061221 163923.325 20061221 163926.381 003.056 6123456789012 00000F75 062 02 002 123 00008001 510103342614669
underline is shortcode and bold is causes code
the filename is in date format like "2006122001.TDR" and the file generated each hour like 2006122002.TDR,2006122003.TDR,etc. the file log found at /log/TDR/
--> i want to check into the file (e.g. 2006122000.TDR) line by line and get how much shortcode having causes code "00008001".
--> generate it into a file (e.g. 2006122000.log) per hour the info which shortcode having cause code "00008001"
--> count per shortcode how much each short code having causes code "00008001". (e.g. 123 count 20, 465 count 30,etc)
--> send it through sms using syntax : msggen msggen_SMClient.txt 1 "[01234356789]" "[Result of counted data]"
--> the script will running in background and check for the previous hour log file
please advices help to build simple script for this case
Thank you so much
Regards,
bucci
•
•
Join Date: May 2004
Posts: 177
Reputation:
Rep Power: 5
Solved Threads: 9
This will generate a report like you asked for.
You will have to write another small script that runs under cron (once every hour) and calls the above nawk code with the correct file name.
awk on Solaris is crippled, you have to use nawk to get the features above.
I don't know sms, so someone else will have to help.
nawk '
{ shortcode[$11]=$11
causecode[$12]=$12
result[$11 $12]++
}
END{ for( short in shortcode)
{
for(cause in causecode)
{
if(result[short cause])
{
print short, "count", cause, result[short cause]
}
}
}
} ' filenameYou will have to write another small script that runs under cron (once every hour) and calls the above nawk code with the correct file name.
awk on Solaris is crippled, you have to use nawk to get the features above.
I don't know sms, so someone else will have to help.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access animations breach broadband code combo crime daniweb data data protection data transfer database drive dropdownlist files fix flash flash flv forensics government hard hardware hidden files hitachi how interactivity. internet linux media module multimedia net news reuse scripting security solve ssvichosst storage streaming terabyte video virus web web development wikipedia
- Writing mp3 files to data files (OS X)
- how to Upload files using Linux bash Shell scripting and CGI (Shell Scripting)
- "shell scripting tutorials?" (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: Querry regarding shell script automation.
- Next Thread: inserting characters in text files through shell script


Linear Mode