reading a file for processing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting reading a file for processing
# 8  
Old 04-20-2012
new to scripting

Quote:
Originally Posted by Corona688
Perhaps something like this, if you have bash or ksh:

Code:
# Template script file

VAR1=asdf
VAR2=asdf

function do_something
{
        echo "do_something called"
}

function do_something_else
{
        echo "Wow, something else"
}

And you'd use it like
Code:
. /path/to/template ; do_something ; do_something_else

may be i could not get it completely: what are those function for in each script? please elaborate bit more.

problem here is:
each subprojects belogs to different group they dont wana write script/methods, instead they simple wana tell me files and cmmands and let me do how/what i do.
# 9  
Old 04-20-2012
Quote:
Originally Posted by ajayyadavmca
may be i could not get it completely: what are those function for in each script? please elaborate bit more.
They are the 'configuration files'.
Quote:
problem here is:
each subprojects belogs to different group they dont wana write script/methods, instead they simple wana tell me files and cmmands and let me do how/what i do.
They are shell scripts though, even if they don't realize it. Look at them -- they set variables, run commands, and even redirect file output. About the only difference is the useless "cmd=" on the front of some lines.

If that's the way they really want to write them, perhaps they can be translated into shell scripts whenever you need to actually use them.

I still need more detail on what they're actually supposed to do if you need more than vague answers.
# 10  
Old 04-20-2012
Quote:
Originally Posted by Corona688
They are the 'configuration files'. They are shell scripts though, even if they don't realize it. Look at them -- they set variables, run commands, and even redirect file output. About the only difference is the useless "cmd=" on the front of some lines.

If that's the way they really want to write them, perhaps they can be translated into shell scripts whenever you need to actually use them.

I still need more detail on what they're actually supposed to do if you need more than vague answers.
i thought i have explained it well:
So all this process is when any error occurs in any of project they want to collect some logs and some information so these configuration template have files need to be copied at one place and cmd which will generate output that also need to be copied , so basically these configuration files are kind of template for them. so later if they want me to collect more data they can just add that in this file and i will process those for them. after collecting the data i will create a zip which will be used for debugging.

make sense or have any other question.
# 11  
Old 04-23-2012
So this:

Code:
file=/var/log/log1.log
file=/var/log/log2.log
cmd=ls -l
cmd=dir > /var/log/mylog.log

mean "run these commands, and on error, collect the above log files"?

The commands don't seem to have anything to do with the log files.
# 12  
Old 04-25-2012
thanks

thanks corona, i have changed the way of those file as you suggested before. so thats not required.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

2. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

3. Shell Programming and Scripting

Recursive file processing from a path and printing output in a file

Hi All, The script below read the path and searches for the directories/subdirectories and for the files. If files are found in the sub directories then read the content of the all files and put the content in csv(comma delimted) format and the call the write to xml function to write the std... (1 Reply)
Discussion started by: Optimus81
1 Replies

4. Shell Programming and Scripting

How to make parallel processing rather than serial processing ??

Hello everybody, I have a little problem with one of my program. I made a plugin for collectd (a stats collector for my servers) but I have a problem to make it run in parallel. My program gathers stats from logs, so it needs to run in background waiting for any new lines added in the log... (0 Replies)
Discussion started by: Samb95
0 Replies

5. Shell Programming and Scripting

reading a file inside awk and processing line by line

Hi Sorry to multipost. I am opening the new thread because the earlier threads head was misleading to my current doubt. and i am stuck. list=`cat /u/Test/programs`; psg "ServTest" | awk -v listawk=$list '{ cmd_name=($5 ~ /^/)? $9:$8 for(pgmname in listawk) ... (6 Replies)
Discussion started by: Anteus
6 Replies

6. Shell Programming and Scripting

Reading a file line by line and processing for each line

Hi, I am a beginner in shell scripting. I have written the following script, which is supposed to process the while loop for each line in the sid_home.txt file. But I'm getting the 'end of file' unexpected for the last line. The file sid_home.txt gets generated as expected, but the script... (6 Replies)
Discussion started by: sagarparadkar
6 Replies

7. Shell Programming and Scripting

how to change the current file processing to some other random file in awk ?

Hello, say suppose i am processing an file emp.dat the field of which are deptno empno empname etc now say suppose i want to change the file to emp.lst then how can i do it? Here i what i attempted but in vain BEGIN{ system("sort emp.dat > emp.lst") FILENAME="emp.lst" } { print... (2 Replies)
Discussion started by: salman4u
2 Replies

8. Shell Programming and Scripting

Checking for a control file before processing a data file

Hi All, I am very new to Shell scripting... I got a requirement. I will have few text files(data files) in a particular directory. they will be with .txt extension. With same name, but with a different extension control files also will be there. For example, Sample_20081001.txt is the data... (4 Replies)
Discussion started by: purna.cherukuri
4 Replies

9. Shell Programming and Scripting

Have a shell script check for a file to exist before processing another file

I have a shell script that runs all the time looking for a certain type of file and then it processes the file through a series of other scripts. The script is watching a directory that has files uploaded to it via SFTP. It already checks the size of the file to make sure that it is not still... (3 Replies)
Discussion started by: heprox
3 Replies
Login or Register to Ask a Question