473,385 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help : Unix Add date to a file on every begining of line from other text file

1
Hi ,

I'm still newbie
Anyone can help me for putting date into a file which grep from other file? I use sed command but it gets error since the date format determine as a command. Here is the case :

"text1.tmp" contains :
Post Date 07/01/2008

"text2.tmp" contains :

1234562 45.0 xxxxxx
4452234 50.0 zzzzzz

How to use get only the date from text1 and add to every begining of the line of text2.tmp as below ?

07/01/2008 1234562 45.0 xxxxxx
07/01/2008 4452234 50.0 zzzzzz

thanks in advanced before.
Feb 15 '08 #1
1 3763
ashitpro
542 Expert 512MB
Hi ,

I'm still newbie
Anyone can help me for putting date into a file which grep from other file? I use sed command but it gets error since the date format determine as a command. Here is the case :

"text1.tmp" contains :
Post Date 07/01/2008

"text2.tmp" contains :

1234562 45.0 xxxxxx
4452234 50.0 zzzzzz

How to use get only the date from text1 and add to every begining of the line of text2.tmp as below ?

07/01/2008 1234562 45.0 xxxxxx
07/01/2008 4452234 50.0 zzzzzz

thanks in advanced before.

Here we go..
Next code will give you the output file as text3.tmp
Expand|Select|Wrap|Line Numbers
  1. my_date=`grep -o '../../....' text1.tmp`
  2. for i in `cat text2.tmp`
  3. do
  4.     echo $my_date $i >> text3.tmp
  5. done
  6.  
Feb 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Danny Jensen | last post by:
I need to test if certain processes on a unix box were running. I wanted to use whatsup gold to do the testing. First I needed to go to the whatsup configure>monitors & services menu to add this...
1
by: wtnt | last post by:
Hello. I've searched all over and haven't seen another thread with this problem. Please bear with me as I try to explain. thanks. :) I have some programs that need to be cross-platform...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
0
by: hagar | last post by:
Hi all, I have a problem which I can not understand why this is happening! Debugging this I actually see that it grabs first record then when stepping through code to the line rsImportTo.AddNew...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
budigila
by: budigila | last post by:
Hiya peeps, Okies, I have been trying to work this out for a while now to no avail... I am a beginner to this whole coding thing but have made great strides in my project. Basically what I am...
4
by: ndedhia1 | last post by:
I am reading in a file to see what delays I am getting on what IP address: QuoteBlockTiming exceeded 1000 ms: 1684 --- Fri Nov 06 06:09:10 CST 2009 170.137.94.95 Class key = 649126730 block...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.