Script to create text file.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to create text file.
# 1  
Old 05-23-2010
Question Script to create text file.

Hi all

Below this is my script..I want to write the command to create a text file in my script below. If anyone know how to do...show me the result.I also want to do this script run automatically without type in terminal.

Thanks.

Code:
#!/usr/bin/sh
DIR1="/ebs/home/ebs_dba/data/KLM/logicload/input/STDF4_UNIX_TMP"
DIR2="/ebs/home/ebs_dba/data/KLM/logicload/datarelease/input"
DIR3="/ebs/home/ebs_dba/data/loader/STDF/input"
DIR4="/ebs/home/ebs_dba/data/loader/STDF/save"
DIR5="/ebs/home/ebs_dba/data/loader/STDF/save_done"
echo " "
echo "             TITLE               "
echo "EBS MONITORING APPLICATION SYSTEM"
echo "--------------------------------- "
echo "Total Files for this directory $DIR1 is:"
ls -l  $DIR1 | grep "^-" | wc -l
echo "Total Files for this directory $DIR2 is:"
ls -l $DIR2 | grep "^-" | wc -l
echo "Total Files for this directory $DIR3 is:"
ls -l  $DIR3 | wc -l
echo "Total Files for this directory $DIR4 is:"
ls -l $DIR4 | wc -l
echo "Total Files for this directory $DIR5 is:"
ls -l $DIR5 | wc -l
echo " "
 
echo "File system that are monitor"
echo "--------------------------- "
echo ""
df -k  /ebs/data
echo ""
df -k  /ebs/home/ebsxe
echo ""
df -k /ebs/home/ebs_dba
echo ""


Last edited by Yogesh Sawant; 05-24-2010 at 03:13 AM.. Reason: added code tags
# 2  
Old 05-23-2010
Assuming your script works fine and you simply want to append it's output to a file, try
Code:
./yourscript >> logfile.txt

or
Code:
./yourscript > logfile.txt

to create a fresh file respectively overwrite the existing one.

If you want it to run automatically, you will most likely want to create a cronjob.
Check this Linux Crontab: 15 Awesome Cron Job Examples (link removed) and see if you can set it alone.

If not, feel free to ask a specific question.
This User Gave Thanks to pseudocoder For This Post:
# 3  
Old 05-24-2010
hi,

where should i type this command..
Code:
./yourscript >> logfile.txt

inside my script or in terminal

Last edited by Yogesh Sawant; 05-24-2010 at 03:13 AM.. Reason: added code tags
# 4  
Old 05-24-2010
In terminal.
# 5  
Old 05-24-2010
how is the command if i want to do in script?
# 6  
Old 05-24-2010
You would have to append >> logfile.txt to the end of every line, beginning from the first echo "" until last line.
Code:
echo " " >> logfile.txt
echo " TITLE " >> logfile.txt
echo "EBS MONITORING APPLICATION SYSTEM" >> logfile.txt
echo "--------------------------------- " >> logfile.txt

and so on...

Last edited by pseudocoder; 05-24-2010 at 12:50 AM..
# 7  
Old 05-24-2010
hi pseudocoder,

i have try in my script..It done..

Thanks for your help...

SmilieSmilieSmilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create a text file and a pdf file from Linux command results.

Hello. The task : Using multiple commands like : gdisk -l $SOME_DISK >> $SOME_FILEI generate some text file. For readiness I must insert page break. When the program is finished I want to convert the final text file to a pdf file. When finished, I got two files : One text file and One pdf... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Splitting a text file into smaller files with awk, how to create a different name for each new file

Hello, I have some large text files that look like, putrescine Mrv1583 01041713302D 6 5 0 0 0 0 999 V2000 2.0928 -0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 5.6650 0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 3.5217 ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

3. Shell Programming and Scripting

Create csv from text file

Gents, I am trying to create a csv file using the file attached. I have a problem to get all information required because the rows are not continues. Here is my code till now. awk ' /"ffid"/{if(s){print s;s=$NF}else{s=$NF}} /"LineNumber"/{s=s $NF} /"PointNumber"/{s=s $NF}... (4 Replies)
Discussion started by: jiam912
4 Replies

4. Shell Programming and Scripting

Copy text and create new file

I have a directory with ~500 files that look like below. I need to copy each unique entry up until the second_ only once and put a .txt in place of the _. I am not quite sure how but have the below as a startThank you :). cp -u file1.txt "$(cat output.txt)" file1.txt ... (4 Replies)
Discussion started by: cmccabe
4 Replies

5. Shell Programming and Scripting

Create users from a text file by script

Hi All, I am new to scripting, i want to create one script in which i can add users from a text file, assign them a default password like 123456. It should be like: Username= $i (it should take users from text file one by one) Password : 123456(default for every user) (1 Reply)
Discussion started by: prad_rocxx
1 Replies

6. Shell Programming and Scripting

How to create a shell script to read a foldername from a text file and go to the folder?

Hi, I am trying to write a shell script which can read folder names from a text file and then go to the folder and picks up a xml file and write on my sipp script so that I can run the sipp script. For example: I have a text file called thelist.txt where I have provided all the folders... (7 Replies)
Discussion started by: pm1504
7 Replies

7. Shell Programming and Scripting

Script to create a text file whose content is the text of another files

Hello everyone, I work under Ubuntu 11.10 (c-shell) I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment. I will show you an example: - On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Discussion started by: tenteyu
1 Replies

8. Shell Programming and Scripting

Need help in writing a script to create a new text file with specific data from existing two files

Hi, I have two text files. Need to create a third text file extracting specific data from first two existing files.. Text File 1: Format contains: SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010 some text ............so on...and somwhere text like: Record 1:... (1 Reply)
Discussion started by: shashi143ibm
1 Replies

9. Shell Programming and Scripting

Create multiple text file from a single text file on AIX

Hi I need to create multiple text files from onc text file on AIX. The data of text files is as below: ********************************************** ********************************************** DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009 Copyright (c) 1982,... (11 Replies)
Discussion started by: lodhi1978
11 Replies

10. UNIX for Dummies Questions & Answers

create a text file in a script

Hi, i want to create a text file (init${x}.ora) and write information to it via a korn shell script. Is it right to do it as shown below (the file doesnt exist yet)? x=$1 file="$ORC/dbs/init${x}.ora" echo "info here..." >> $file will this file get created? (2 Replies)
Discussion started by: n8575
2 Replies
Login or Register to Ask a Question