Sponsored Content
Full Discussion: cat command
Operating Systems AIX cat command Post 302123532 by kwliew999 on Tuesday 26th of June 2007 03:17:05 AM
Old 06-26-2007
Paste

Hi, I have tried the suggestion of you all and they works fine. Thanks a lot for the help. But now I have another question which is also part of the paste command question.

I have a scripts to backup some files (which will have different filename according to the date) using pax command and some condition to met as well. Due to the filename will change according to date, I am thinking of using paste command to paste the script line by line into a script file and run the script file after it has been constructed.

script file to be executed: (sh_menu.sh)
#!/bin/sh
if [ `df -k /u01/EXPORT | awk '{getline; print $3}'` -ge `expr 5 \* 1024 \* 1024` ] ; then
cd /u01/EXPORT
pax -wvf /dev/rmt0 ./dataddmmyyyy/*.dbf
echo "File system being backup is ddmmyyyy"
else
echo "Disk space low."
fi

Thus, I will need another script to form the above script.

I will need to create some text file which contained
header1.txt = "#!/bin/sh"
header2.txt = "if [ `df -k /u01/EXPORT | awk '{getline; print $3}'` -ge `expr 5 \* 1024 \* 1024` ] then"
header3.txt = "cd /u01/EXPORT"
body1.txt = "pax -wvf /dev/rmt0 ./data"
body2.txt = "/*.dbf"
body3.txt = "echo "File system being backup is "
body4.txt = """
body5.txt = "else"
body6.txt = "echo "Disk space low.""
body7.txt = "fi"

And then use a script to combine all these files. (Main.sh)
#!/usr/bin/ksh
date '+%m %d %Y' |
{ read MONTH DAY YEAR
echo $YEAR$MONTH$DAY > var1.txt
A=`paste -d'\n' body1.txt var1.txt body2.txt > temp1.txt`
B=`paste -d'\n' body3.txt var1.txt body4.txt > temp2.txt`
C=`paste -s -d'\0' temp1.txt > tempbody1.txt`
D=`paste -s -d'\0' temp2.txt > tempbody2.txt`
E=`paste -d'\n' header1.txt header2.txt header3.txt temp1.txt temp2.txt body5.txt body6.txt body7.txt > sh_menu.sh`
F=`./sh_menu.sh`

Is there any other simple way to do it?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

the CAT command

hi everybody, how do i open a txt file writen in unix on to a web page so when i want to view the txt file that was generated from a shell program, that file is open on a web page do i use the cat > filename.html command to do this, or is there another way many thanks :D (2 Replies)
Discussion started by: alexd
2 Replies

2. Shell Programming and Scripting

cat command

What does the below command means $cat <<% >abc.txt (3 Replies)
Discussion started by: surjyap
3 Replies

3. UNIX for Dummies Questions & Answers

CAT command

All - how do i save the file after i used CAT command line to modify? Thanks :confused: (2 Replies)
Discussion started by: March_2007
2 Replies

4. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

5. UNIX for Advanced & Expert Users

cat command

Dear All I have two text files File1.txt and File2.txt . I am concatenating the two files and making it as single file Cat_File.txt. Now i need to keep joined file in two different path. that is I need to use cat command only once ,but store joined file in two different locations. Since... (3 Replies)
Discussion started by: tkbharani
3 Replies

6. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

7. UNIX for Advanced & Expert Users

cat command

I believe I used the cat command to append a file beside another file (instead of below it) but I did not document it any where and I can't remember exactly how I did it. Has anyone else done this? I have tried all the cat options individually with no luck. It may be a combination of options. ... (2 Replies)
Discussion started by: nickg
2 Replies

8. Shell Programming and Scripting

Cat command help

I want to concatenate 100 files to one file and append file name in each record to find out which file it came from for a in $(<shal_group) do cat $a >> bigoutput.group The above code put all files in one file but i want file name appended to each file Record should be like this... (3 Replies)
Discussion started by: pinnacle
3 Replies

9. Homework & Coursework Questions

Need some help on using cat command

I have a file "sample.txt" with the content as below: Hi This is a Sample Text. I need a single command using cat which serve the following purpose. 1.display the contents of sample.txt 2.append some text to it 3. and then exit But, all should be served by a sinle... (1 Reply)
Discussion started by: ashok.g
1 Replies

10. AIX

cat command

Hi. How can i write a command on AIX like the one i did at linux that find string in a file and show me that string, and return 3 lines before and 4 lines after that string. my linux command is: /bin/cat <filename> | tail -150 | grep -B2 -A8 "<string to look for>" Example: /bin/cat ... (10 Replies)
Discussion started by: yechi_r
10 Replies
PESCETTI(1)						      General Commands Manual						       PESCETTI(1)

NAME
pescetti -- Pseudo-Duplimate Generator SYNOPSIS
pescetti DESCRIPTION
This manual page documents briefly the pescetti command. OPTIONS
Here are a list of the available options and what they do. You must specify exactly one from --demo, --generate or --load. --help Prints the help text --demo Demonstration mode. Generates one hand with permutations and the tutorial for how to use them. --generate=N Generate N random boards --load=boards.txt Load boards+analysis from boards.txt --load-dds=boards.dds Load boards from boards.dds in dds format --load-analysis=tricks.txt Load analysis from tricks.txt --permutations=permutations.txt Generate the permutations and save them to the given file --curtains=curtains.txt Save curtain cards to file curtains.txt --save=boards.txt Save the boards+analysis to boards.txt --save-dds=boards.dds Save the boards to boards.dds in dds format --save-analysis=tricks.txt Save the analysis to tricks.txt --format=html|txt|pdf Set the output mode to the given format --title=title Set the title for the output --output=hands.txt Print the hands to hands.txt, rather than to standard output --stats Generate statistics about the set of boards; included in the hands output --analyze Run the dds analyzer on the boards and print the resulting numberof tricks (warning SLOW) --criteria= A list of criteria to apply to each generated hand to generate specific hand types. The list should be space separated and each item may be suffixed with a colon and a (fractional) probability value which can be used to weight the criteria. E.g. --criteria="weaknt:0.8 strongnt:0.5" Valid criteria are: unbalanced weaknt strongnt twont strongtwo weaktwo three twoclubs 4441 singlesuit twosuits partscore game slam game-invite slam-invite jumpshift jumpfit splinter bacon weird --probability=factor Generate hands matching the criteria with only the given probability. Factor is in the range 0 to 1. On each attempt to generate a board it is rejected if it doesn't match the criteria with the given probability. A factor of about 0.8 gives roughly half matching boards AUTHOR
This manual page was written by Matthew Johnson <debian@matthew.ath.cx>. Permission is granted to copy, distribute and/or modify this docu- ment under the terms of the GNU General Public License, Version 2 as published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. PESCETTI(1)
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy