[Solved] How to create a script by combing two files?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] How to create a script by combing two files?
# 8  
Old 01-20-2014
Use double >> to append or use > after the done statement:

Code:
.... ; done > File1

# 9  
Old 01-20-2014
Pls compare your code snippet painstakingly with mine...
# 10  
Old 01-20-2014
Quote:
Originally Posted by anshu ranjan
Yes, it worked ..!!
instead of giving value as "16" i just want to give input of cat projects|wc -l
example
Code:
DATE=`date "+%Y-%m-%d"`
value=`cat projects|wc -l`
for (( i=1; i<=$value; i++ )); do echo $DATE > File1; done

but it is giving only one entry in file1.

Code:
cat file1
2014-01-20

change to >>file1

# Redirect output to file "filename" overwrite if file is existing
command >filename

# Redirect and append output to file "filename"
command >>filename


# 11  
Old 01-20-2014
Thanks everyone .. this has been resolved.
i was doing silly mistake. I was using "> File1" but it should be ">>File1"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Python Combing Two Commands

I have been digging deeper into Python and want to make my code as efficient as possible. The less line of code the better so I have been experimenting and wanted to ask the Python gurus if this is possible. So: ... ... In : kbfileurl = re.search('<p>For more information about this... (6 Replies)
Discussion started by: metallica1973
6 Replies

2. Shell Programming and Scripting

How to create or convert to pdf files from csv files using shell script?

Hi, Can anyone help me how to convert a .csv file to a .pdf file using shell script Thanks (2 Replies)
Discussion started by: ssk250
2 Replies

3. Shell Programming and Scripting

[Solved] Help with shell Script ,wait for some files for some time??

Hi All, I have the requirement that ,i have to write a shell script that job has to wait for a 7 touch files created by another application for 4 hours, if i get all 7 touch files ,i have to send a mail that i jobs are completed, if if it is waiting for more than 4 hours i have to send a mail... (2 Replies)
Discussion started by: Pradeep Shetty
2 Replies

4. Shell Programming and Scripting

[Solved] Script to concatenate 2 files with the same number of lines

Hi everyone, I have two files, namely: file1: file1Col1Row1;file1Col2Row1;file1Col3Row1 file1Col1Row2;file1Col2Row2;file1Col3Row2 file1Col1Row3;file1Col2Row3;file1Col3Row3file2: file2Col1Row1;file2Col2Row1;file2Col3Row1 file2Col1Row2;file2Col2Row2;file2Col3Row2... (0 Replies)
Discussion started by: gacanepa
0 Replies

5. Shell Programming and Scripting

[Solved] Get files & delete them by shell script

I want to use my script to get any file then delete it once it transfers to my side , I manage to create below script to generate "list" file which contains all file names in "10.10.1.1" then I made "a.out" file which contains the commands that I want to run it on "10.10.1.1" to get & delete the... (2 Replies)
Discussion started by: arm
2 Replies

6. HP-UX

[Solved] Help with a script to gzip/move files

Hi Please can you help me in writing a script to find files on a specific directory, and of extension "tap" but only of the month of september, gzip and move them to another directory. Your help will be appreciated. (8 Replies)
Discussion started by: fretagi
8 Replies

7. HP-UX

[Solved] HOW TO CREATE VM IN HP UX 11.31

can any one tell me ..HOW TO CREATE VM IN HP UX 11.31 V3... (2 Replies)
Discussion started by: hsejar123
2 Replies

8. Shell Programming and Scripting

Script to create files

Requirement:- SQLs select name from v$datafile; select name from v$controlfile; select name from v$tempfile; select MEMBER from v$logfile; These sqls has to run in one script and o/p of each sql has to write in seperate files.But the o/p is like if we issue select name from... (2 Replies)
Discussion started by: Sanal
2 Replies

9. Shell Programming and Scripting

combing two lines

Hi list, I have to combine two lines and adding the " - " in between. So: Here's sentence A Here's Senctence B Here's sentence A - Here's Senctence B I know how to us SED: sed '$!N;s/\n/ /' for combining tow lines. But how do I insert the " - " correctly? Thanks! Martijn (os... (4 Replies)
Discussion started by: M474746
4 Replies

10. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies
Login or Register to Ask a Question