How to save and run a list of commands?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to save and run a list of commands?
# 1  
Old 05-08-2013
How to save and run a list of commands?

Dear every one,
I am working with the data of my lab program and I have to do many times by the same list of some commands (grep, then save to file, then use awk to delete odd lines, save to file, use awk to delete even lines, save to file...).
Is there any way to save a list of command which I usually work with and then run them in the current shell?
I tried using {} as written in this site
IBM notice: The page you requested cannot be displayed
but it does not work.

Thanks a lot.Smilie
# 2  
Old 05-08-2013
Quote:
Originally Posted by phamnu
but it does not work.
Can you provide details regarding in what ways your group command does not work?

If possible post the group command that you attempted to run and errors if any.

It is really difficult to comment without knowing what exactly you did and what issues you faced.
# 3  
Old 05-08-2013
Here is the error I got.
{ grep -v 'Ni' Md_Coordinates.xyz > test.txt grep 'H' test.txt>test1.txt awk 'NR%2==0' test1.txt>test2.txt; }
Ambiguous output redirect.

and I could not see the files test.txt, test1.txt...
# 4  
Old 05-08-2013
While grouping commands in single line, each commands has to be separated by semi-colon to clearly define boundary:
Code:
{ grep -v 'Ni' Md_Coordinates.xyz > test.txt; grep 'H' test.txt > test1.txt; awk 'NR%2==0' test1.txt > test2.txt; }

This User Gave Thanks to Yoda For This Post:
# 5  
Old 05-08-2013
thank you!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to save data and run the server again / Ubuntu16.04?

Hello, I am running ubuntu 16.04 and I have rented a server three days ago. I am with OVH and during image installation I did not merge hdd partitions, just proceed with custom installation configuration. Today I rebooted and server went offline. Company says: "Connect in rescue mode and check... (4 Replies)
Discussion started by: baris35
4 Replies

2. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies

3. UNIX for Dummies Questions & Answers

To run 5 commands at the same time with process from a list

I have many command is list in the variable lists,each command will run a very long time, so I want to run 5 commands at the same time with process till it complete run all the command, lists="aa bb cc dd xx gg blabla zz ......." ( a very long list) can some one point me the codes? ... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

4. AIX

List of AIX commands that can be run by ROOT user ONLY

Hello, I am testing sudo and I want to test it. Can anyone please let me know few commands (of course other than shutdown, reboot etc. as I can't reboot the box) on AIX that can be run by ROOT only. Thanks ---------- Post updated at 07:43 PM ---------- Previous update was at 07:38 PM... (5 Replies)
Discussion started by: prvnrk
5 Replies

5. Shell Programming and Scripting

How to save and execute terminal commands in shell?

I frequently use some commands, which I want to save in some file say myregularshell.shthese are the commands I use, I tried saving and executing, but couldn't get the preview of execution, and result is also not coming if I copy same commands and paste it on terminal result is coming cd go... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

6. Shell Programming and Scripting

Create a list of commands in a central location, and then run them all remotely through a ssh here

I'm trying to write a script that in the end will from one central location hop to a bunch of servers and then run a series of ping tests. The thing is, the list of devices that needs to be pinged is going to be different for each server. So what I want to do is be able to do is read through the... (0 Replies)
Discussion started by: DeCoTwc
0 Replies

7. UNIX for Dummies Questions & Answers

I'm unable to run Keyed List commands(in ubuntu's terminal and Evolane Tcl Engine)

I'm trying to run these commands (keylset,keylget) but i keep getting a error message "invalid command name "keylset"". I've tried running it on both ubuntu's terminal and also Evolane Tcl Engine. Any idea what could be the problem? (1 Reply)
Discussion started by: abe171
1 Replies

8. Shell Programming and Scripting

Save the output of the command run as other user

Dear All, I am writing a script and kind of stuck in a small thing. Cannot figure it out. so please help I am logged in as root user. I want to switch user to "user1" inside the script and execute a specific command lets say "pwd" and come back where i started. I know how to switch user,... (16 Replies)
Discussion started by: suhail.sadaqat
16 Replies

9. UNIX for Dummies Questions & Answers

Using history of commands to save typing?

Hi, How do I add a history function to my shell? What I mean is if I have used the command: xemacs file.tex, I'd like to be able to type 'x' then use the arrow keys and go through all the commands I've done starting with an 'x'. Thanks! (3 Replies)
Discussion started by: pmasterkim
3 Replies

10. Linux

Configure apache to run with perl ... while running from browser it asks to save .pl

I have installed fedora 9 and trying to run .pl (perl files) from browser. I have below RPM installed: ---------------------------------- httpd-2.2.8-3.i386 mod_perl-2.0.3-21.i386 $cat /etc/httpd/conf.d/perl.conf LoadModule perl_module modules/mod_perl.so Alias /perl /var/www/perl... (4 Replies)
Discussion started by: sriram003
4 Replies
Login or Register to Ask a Question