Making file inside shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Making file inside shell script
# 1  
Old 06-15-2010
Data Making file inside shell script

Hi,

i have written a shell script and its working fine till now. Now, i have to enhance it with a small updation.
i need to make a file inside my file that will contain the below parameters

1) Customer_id
2) Server_id
3) No. Account

All the above variables are already been taken in the script.
the output of the file should be like below :-

Code:
SERVER:xxxxxxxx
            CUSTOMER:xxxxxxx
            SERVER_ID:x
Account:XXXXXX

name of the file will be :-

Code:
accounts_control_info_<SERVER_ID>

this accounts i am calling in anther function in the script like this:-

Code:
if [[ "${1}" = "ACCOUNTS" ]]
  then
    grep "payer" $2 > ${LOCAL_DIR}/tmp.ci_payer_${CREATION_DATE}_${SERVER_ID}.txt

the above if condition is called inside loop. I need to make a file here with the above entries.

can anyone help me with this.. need urgently
# 2  
Old 06-15-2010
hi,
As per wat i understand u need to create a file with this name (accounts_control_info_<SERVER_ID>)
If i'm correct u can use touch option

Code:
touch /root/file_name_$SERVER_ID.txt

where root is the exact location of the file & server id will keep changing.

Hope this helps
# 3  
Old 06-16-2010
thanks but i got the solution.. thanks a lot
# 4  
Old 06-16-2010
can also do
Code:
cat > file <<eof
fsdfsdfd
sdfsfsfs
eof


Last edited by Franklin52; 06-16-2010 at 09:29 AM.. Reason: Please use code tags, thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is there a way to handle commas inside the data when generating a csv file from shell script?

I am extracting data via sql query and some of the data has commas. Output File must be csv and I cannot update the data in the db (as it is used by other application). Example table FavoriteThings Person VARCHAR2(25), Favorite VARCHAR2(100) Sample Data Greta rain drop on... (12 Replies)
Discussion started by: patk625
12 Replies

2. Shell Programming and Scripting

Sqlplus inside shell script writing to tmp file

Hi, facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there. ANy idea why sqlplus writes in /tmp and how to change or stop this ? (2 Replies)
Discussion started by: rushikeshs
2 Replies

3. Shell Programming and Scripting

Running .sh file inside a shell script

Hello, You might help a newbie like me, I am trying to run a .sh inside my shell script. After running that I need to execute below commands. Here's how my scripts looks like. Hope you can help: #!/bin/sh cd $ORACLE_HOME/owb/bin/unix ./OMBPlus.sh ---> goes to OMB+> directory cd... (10 Replies)
Discussion started by: aderamos12
10 Replies

4. Shell Programming and Scripting

Calling a function in cpp file inside shell script

Hi I need to call a function written in a cpp file with arguments inside the shell script..Can anyone help me how to do this:( (1 Reply)
Discussion started by: rkrish
1 Replies

5. Shell Programming and Scripting

Linux Shell Script to check for string inside a file?

This is what I have so far grep -lir "some text" * I need to check all files on the system for this text, if the text is found I need to change the file permissions so only ROOT has read and write access. How can this be done? (3 Replies)
Discussion started by: mapleleafs89
3 Replies

6. Shell Programming and Scripting

how to access variables in a config file inside a shell script

I'm writing a shell script. I want to put the variables in a separate config files and use those inside my script. e.g. the config file (temp.conf)will have the values like mapping=123 file_name=xyz.txt I want to access these variables in temp.conf(i.e. mapping and file_name) from inside the... (7 Replies)
Discussion started by: badrimohanty
7 Replies

7. Shell Programming and Scripting

making shell script

Hi , I am new to shell scripting I want to make script as to execute followng command mysqldump -u (user name) -p(password) database name>filename.sql this file saves with current date and time and execute automatically at particular time which I give (10 Replies)
Discussion started by: kaushik02018
10 Replies

8. Shell Programming and Scripting

how to redirect the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
Discussion started by: kripssmart
11 Replies

9. UNIX for Dummies Questions & Answers

how to get the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)
Discussion started by: kripssmart
1 Replies

10. Shell Programming and Scripting

How to store the outputs of a shell script inside a log file???

My shell script file name is test.sh and the contents of this test.sh file are ps_file="package1.ps" echo $ps_file ps_file1=`echo $ps_file| sed "s/.ps//g"` echo $ps_file1 ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file1.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file1.pdf Now i... (2 Replies)
Discussion started by: sunitachoudhury
2 Replies
Login or Register to Ask a Question