want to run different files under the same program using shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting want to run different files under the same program using shell script
# 1  
Old 10-04-2007
Java want to run different files under the same program using shell script

suppose have different files
1.1
2.2
3.3
4.4
5.5

All the files have to run under the same command say
tr -d '\n'

so how to run all the files under the same command by using shell script
# 2  
Old 10-04-2007
Do you mean removing all linefeed characters ...

Code:
for d in *.*
do
   tr -d '\n' <$d >tmp
   mv tmp $d
done

# 3  
Old 10-04-2007
Quote:
Originally Posted by porter
Do you mean removing all linefeed characters ...

Code:
for d in *.*
do
   tr -d '\n' <$d >tmp
   mv tmp $d
done

Simply having all those files say abc,def,ghi,fdg,dgg
and print the new files
can i follow like that
for d in abc, def, ghi, fdg, dgg
do
tr -d '\n' <$d >tmp
mv tmp $d
done

or what else give option
thanks
# 4  
Old 10-04-2007
what are the commas for?

The "for" statement takes elements separated by the normal white space rule.

I thought you wanted the files changed, not printed, hence the ">tmp" and "mv tmp $d".

man tr
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read files in shell script code and run a C program on those files

HI, I am trying to implement a simple shell script program that does not make use of ls or find commands as they are quite expensive on very large sets of files. So, I am trying to generate the file list myself. What I am trying to do is this: 1. Generate a file name using shell script, for... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

2. Shell Programming and Scripting

Perl program to run a Shell script issues...

Hi all, I have the following Perl script which is intended to run a Shell script and generate some logging for the purposes of tracking weather or not the script ran. I get an error, of course, since I don't know what I'm doing really. Here is the code: #!/opt/perl/bin/perl -w ... (14 Replies)
Discussion started by: zixzix01
14 Replies

3. UNIX for Dummies Questions & Answers

Using Shell Script To Loop Program Through Multiple Text Files

Hello, So I have approximately 300 files of raw data (.txt) files that I am using to perform statistical analysis. I have been able to construct a Fortran program that is able to perform my statistical analysis on a file by file basis. However, I now want to be able to loop program through... (19 Replies)
Discussion started by: Jimmyd24
19 Replies

4. Shell Programming and Scripting

Help to hide shell terminal and run prompt program after ssh login for specified user

Hey guys, I have some task from my office to lock user on the specified directory after the user logged on using ssh. And then run prompt program to fill the required information. Yeah, just like an ATM system. My question: How could I do those?? AFAIK I have to edit the ~./bashrc. But the... (1 Reply)
Discussion started by: franzramadhan
1 Replies

5. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

6. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

7. Shell Programming and Scripting

Run shell script from C program by calling fork and execl

I need to write a c program that uses the fork and excel system calls to run the shell script mode invoked like this: "./mode 644 ls -l" (that is the argumetns will always be 644 ls -l) here's the mode script: #!/bin/sh octal="$1" shift find . -maxdepth 1 -perm $octal -exec $@ {} \; ... (3 Replies)
Discussion started by: computethis
3 Replies

8. Shell Programming and Scripting

shell script to run .sql files

hi Friends, Please help me in writing shell script to run list of sql files. database is Oracle 9i, unix os is solaris Requirement is 1. sql file must take two inputs a)feed id and b)business date 2.shell script must out put .xls or .csvfile as out put without trimming any column name and... (1 Reply)
Discussion started by: balireddy_77
1 Replies

9. Shell Programming and Scripting

Run shell program in perl

Hello , I want to run some shell scripts in my perl script. I need to read the script's name from a file ( this file includes the name of all the scripts) and run the script one by one.. Please let me know how to go .. Thanks in advance, Radha (5 Replies)
Discussion started by: s123.radha
5 Replies

10. UNIX for Dummies Questions & Answers

how to run a shell command from C program?

Hi mates, i am trying to use the C execvp command to run a shell program like this: ..... char input ; printf("enter your command"); scanf("%ds",input) execvp input .... Compilation is ok but when i run it raise the error : Segmentation Error ... your help will be appreciated. ... (1 Reply)
Discussion started by: abdul
1 Replies
Login or Register to Ask a Question