Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> linux script to run a command by taking input from a file
omerbest
post Nov 13 2011, 07:18 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 13-November 11
Member No.: 15,685



Hi people,

I want to write a script on linux. I am dumping a real time file from my machine. Every time I dump the file, it stores a certain pattern of 32 character string in each line. The number of lines on every attempt of dumping the file could be different. A sample of a dumped file could be:

kjhas87asjaksiui3jhh9898i9isb361
kjhas87asjaksiui3jhh9898i9isb362
kjhas87asjaksiui3jhh9898i9isb363
kjhas87asjaksiui3jhh9898i9isb364

While on dumping the file again, it could be:

kjhas87asjaksiui3jhh9898i9isb365
kjhas87asjaksiui3jhh9898i9isb366

It means every time you dump the file you could have different number of lines and would have different pattern of 32 character string.

Now I wish to design a script which takes these lines (32 character string) as an input to a command as below:

cli call delete 32-character-string

It means the script runs the above command exactly the same time as of the total number of lines present in the dumped file. It could run as a loop, but every time those 32-character-string from each line should process with that command, unless the lines in the file are finished.

Please help me, or give me an idea to write such script.
Thanks in advance!
Go to the top of the page
 
+Quote Post
michaelk
post Nov 14 2011, 06:54 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



If I understand your question. You want to delete lines from a file where it is constantly being updated?
Go to the top of the page
 
+Quote Post
omerbest
post Nov 14 2011, 08:09 AM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 13-November 11
Member No.: 15,685



I want to process those lines (string) in a specific command:

cli call delete string

Usually when the file is being dumped, it has different number of lines. I will incorporate the file dumping scenario with this script, so that the script will run, and it dumps the file, and then take lines from that file and runs it in the above command, one by one, once all the lines of the file is processed.
Go to the top of the page
 
+Quote Post
michaelk
post Nov 14 2011, 02:33 PM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



Should be able to do it via a bash script and sed.
Search for bash using command line variables.
Search for sed deleting lines.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th November 2017 - 05:23 PM