Read in txt file and run a different command for each line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read in txt file and run a different command for each line
# 8  
Old 05-26-2017
Quote:
Originally Posted by giuinha
rather than a basic tutorial, i'm hoping someone can tell me how to gain this one functionality in my script.

why use tcsh? my guess is because the software package i'm running is basically a collection of C programs and most of the scripting from the developers uses tcsh.
I don't see what C has to do with tcsh, but maybe you mean that there is already a bunch of tcsh scripts, and want to extend the functionality, so you want to stick with tcsh.

I personally would even in this case write new features in Zsh or bash or some other suitable language (Ruby, Python, Perl), but of course this is everyone's personal taste. If you really want to continue with tcsh, I fear there is not much alternative, and you will have to spend a day or so going through the tutorial and at least part of the man-page.

If you really need help here, you need to ask a concrete question. The way you asked, is to broad. With which tcsh statement do you have a problem? You could for instance post a statement in bash and ask how to express something similar in tcsh.

Still then, it's not sure that you will get much response, because tcsh is so rarely used. Maybe there are some dedicated tcsh forums around?
# 9  
Old 05-26-2017
Hi.
Quote:
Originally Posted by rovf
If I understand you right, you are looking for a tutorial which teaches you tcsh programming. There won't be much around, since the number of tcsh programmers is, as I have the impression, very small. Even RosetteCode (Category:Programming Languages - Rosetta Code ), which hosts many obscure languages, has no entry for tcsh! You can try

A basic tutorial on the tcsh shell

but in any case also read Csh Programming Considered Harmful . While this targets csh, many of the points discussed in this text also apply to tcsh.
See also Unix Shells: Bash, Fish, Ksh, Tcsh, Zsh - Hyperpolyglot

Best wishes ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Split Every Line In Txt Into Separate Txt File, Named Same As The Line

Hi All Is there a way to export every line into new txt file where by the title of each txt output are same as the line ? I have this txt files containing names: Kandra Vanhooser Rhona Menefee Reynaldo Hutt Houston Rafferty Charmaine Lord Albertine Poucher Juana Maes Mitch Lobel... (2 Replies)
Discussion started by: Nexeu
2 Replies

2. Shell Programming and Scripting

Read file and run a command

Hi I have jobs (some 1000) defined in a file and I want to read those jobs and run a a command. For example: jobs.txt abc efg I want to read the entire file and run the following command Delete -JOB "abc" Deleteing abc... Delete -JOB "efg" Delete efg... Can somebody help me... (4 Replies)
Discussion started by: karan8810
4 Replies

3. UNIX for Dummies Questions & Answers

Read workstation list from file und run command

Hi, how do I read in a file which includes a list of workstations and then run a command for each workstation ? I am unclear which command to use to read in , or is this not possible ? Thanks, (3 Replies)
Discussion started by: manni2
3 Replies

4. Shell Programming and Scripting

Repeat command with new variable for each line in txt file

Well here is my question. Let's say I have this Script: find /var/mobile/ maxdepth -2 name "$x" >> /"$x".txt The thing is I want to repeat this script and pull out a variable from a text file like this (each line = new variable $x and another run of the whole command) Thanks for... (27 Replies)
Discussion started by: pasc
27 Replies

5. Shell Programming and Scripting

Read 2 lines from File, Run Command based off output

Okay, so I have a file containing line after line of three digit numbers. I need a script that does an action based on the last two numbers in this list. So.... To get the last two numbers, I can have the script do tail -2 filename.txt But where I run into trouble is as follows. If... (6 Replies)
Discussion started by: UCCCC
6 Replies

6. Shell Programming and Scripting

read line and run a different command according to the output

Hi. I'm trying to write a script that reads a line on a file and runs a different command for a different line output. For example, if it finds the word "Kuku" on the line it sends mail to Kuku@kuku.com. Otherwise, it sends mail to Lulu@lulu.com. TIA. (2 Replies)
Discussion started by: Doojek9
2 Replies

7. UNIX for Dummies Questions & Answers

Command to delete numbers at beginning of txt file line

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt awk 'NR%2==0' test1.txt >... (4 Replies)
Discussion started by: li_bi
4 Replies

8. Shell Programming and Scripting

i need to read the last line in a txt file

i'm a beginner in shell and i have a txt file that is updating every second or msec so i need a program to read the last line of this txt file is this possible to do? (5 Replies)
Discussion started by: _-_shadow_-_
5 Replies

9. UNIX for Dummies Questions & Answers

How to read last line of a txt file?

I need to read the last file for a particular day, such as, "Jun 13" because the CSV file is cumulative for the entire day, so I don't want all the previous files, I just want the last file, for that day. I ran an 'ls -al | grep "June 13" > myLs.txt' (simplified) to list all files from that day.... (2 Replies)
Discussion started by: yongho
2 Replies

10. UNIX for Dummies Questions & Answers

want to read txt fileline by line

Hi , i want to read a text file line by line , is there any unix command or utility for this ? please tell me how to use it also ? (2 Replies)
Discussion started by: dharmesht
2 Replies
Login or Register to Ask a Question