![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| If statement - How to write a null statement | april | Shell Programming and Scripting | 3 | 04-16-2008 01:14 PM |
| How do i execute in IF ELSE Statement | laknar | Shell Programming and Scripting | 1 | 06-08-2007 02:54 AM |
| Script does not execute Insert Statement | Amruta Pitkar | Shell Programming and Scripting | 4 | 08-24-2006 11:14 PM |
| Need to execute 2 scripts, wait, execute 2 more wait, till end of file | halo98 | Shell Programming and Scripting | 1 | 08-01-2006 04:42 PM |
| How can I get an if statement to execute based on number of lines in a file? | LordJezo | Shell Programming and Scripting | 6 | 05-14-2004 10:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Need to execute the same statement
I have written a script for converting an IP address into its corresponding AS number in PHP. But based on the timing analysis, I've observed that it takes a long time to process large number of entries. So I need to do something directly in unix. What method would one suggest for this purpose?
Purpose: There is a statement: nc whois.sampleserver.com portnumber After entering that, I need to enter the ip address and after entering it gives me the AS number in the forum of a line. I need to use regular expressions to capture the AS number and then store it in a file. After this, I need to type that same command again and repeat the procedure. Can someone please tell me what I have to do to achieve the above? Is it shell scripting or direct coding in languages like C? |
|
||||
|
The general format is
while : do cmd1 cmd2 .. sleep 60 done In this case we'll sleep 60 seconds between executing commands. For the second part (formatting the output), we'd need to know what you want it to look like.. but again rather generally: .. cmd1 | filter_script >> somefile .. |
|
||||
|
Prototype in shell script then I suggest Perl as that lets you handle regular expressions fairly easily.
|
|
||||
|
Oh.. Ok..Thank you... Then I'll start reading Perl.. But will I be able to do all these with that?
Execute shell commands Grab the output like the popen command you showed me yesterday Work with regular expressions Read and write into files I was wondering if SQL commands can be executed Thanks |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|