Print particular time upto the next occurance


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Print particular time upto the next occurance
# 1  
Old 01-19-2012
Print particular time upto the next occurance

Hi Guys,
I am having some issue in one aspect. I am having data like -

00:00
X-1
Y-1
Z-4
A-5
E-6
.
.
.

.
01:00
Z-9
X-1
Z-5
A-8
E-7
.
.
.
and so on till

23:00
Z-9
X-1
Z-5
A-8
E-7
.
.
Now I need output like -
00:00 X-1
00:00 Y-1
00:00 Z-4
00:00 A-5
00:00 E-6
01:00 Z-9
01:00 X-1
01:00 Z-5
01:00 A-8
01:00 E-7
.
.
.
23:00 Z-9
23:00 X-1
23:00 Z-5
23:00 A-8
23:00 E-7

Thanks in advance.
# 2  
Old 01-20-2012
Code:
awk '/:/ {col=$0; next} {print col, $0}'  inputfile

This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 01-20-2012
Thanks Jim Mcnamara !!! You are awesome !!! Its what I wanted.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Getting files through find command and listing file modification time upto seconds

I have to list the files of particular directory using file filter like find -name abc* something and if multiple file exist I also want time of each file up to seconds. Currently we are getting time up to minutes in AIX is there any way I can get file last modification time up to seconds. (4 Replies)
Discussion started by: Nitesh sahu
4 Replies

2. Shell Programming and Scripting

Find a string and print all lines upto another string

Ok I would like to do the following file test contains the following lines. between the lines ABC there may be any amount of lines up to the next ABC entry. I want to grep for the filename.txt entry and print the lines in between (and including that line) up to and including the last line... (3 Replies)
Discussion started by: revaroo
3 Replies

3. UNIX for Dummies Questions & Answers

Delay of upto 7 seconds after typing in putty

Hi Friends, I am facing a very strange issue . I type something on putty session of servers of my work(locating in North America) and it appears only after 7 seconds or so. I am located in India. It doesn't happen with my colleagues who are sitting next to me :(. I use the ssh protocol to connect... (4 Replies)
Discussion started by: kunwar
4 Replies

4. Shell Programming and Scripting

How to round up value upto 2 decimal places using sed?

Please help me in rounding up value upto 2 decimal palces using sed command #!/usr/bin/bash a=15.42 b=13.33 c=`echo $a*$b |bc -l` echo $c above code is is giving output "205.5486" but i want the output as "205.55" Thank you... (15 Replies)
Discussion started by: ranabhavish
15 Replies

5. Shell Programming and Scripting

Compare two timestamps and print elapsed time

Hi, I am unable to Difference between two time stamps in Linux and display the total elapsed time . Source date: Aug 15, 2012 02:00:03 Target date: Aug 14, 2012 18:00:03 # based on the forums I am using the below function. Converted dates into this format Src_dt=20120814180003... (7 Replies)
Discussion started by: onesuri
7 Replies

6. UNIX for Advanced & Expert Users

How to get access time of a file upto the precision of seconds?

Hi , How can I get the last access time of a file upto the precesion of seconds in Unix. I cannot use stat as this is not supported. (10 Replies)
Discussion started by: kanus
10 Replies

7. Shell Programming and Scripting

Print each user at time

I want to print each user at time and I wrote : cat /etc/passwd | grep "/home" | cut -d: -f > USERS for USER in `cat USERS` do echo "$user" done but it didn't work thanks (7 Replies)
Discussion started by: testman84
7 Replies

8. Shell Programming and Scripting

How to insert values in 1st occurance out of two occurance in a file

Hi I have a file which contains the following two lines which are same But I would like to insert the value=8.8.8.8 in the 1st occurance line and value=9.9.9.9 in the 2nd occurance line. <parameter name="TestIp1" value=""> <parameter name="TestIp1" value=""> Please suggest (1 Reply)
Discussion started by: madhusmita
1 Replies

9. Shell Programming and Scripting

how to print the date and time separately???

HI, I have a script where the date and time has to e printed separately as below date = "Wed Jan 16 2008" time = "14:17:57 IST" using date command gives me tho out put Wed Jan 16 14:17:57 IST 2008 i need only Wed Jan 16 2008 and 14:17:57 IST both stored in two different variables.... (8 Replies)
Discussion started by: jisha
8 Replies

10. UNIX for Advanced & Expert Users

limiting characters upto <xyz> columns

Hi, Recently i did some code changes in one of the text file. During the code review,i've been asked to allign the comments in this file to XYZ columns(say XYZ=40). Now the problem is that this file is a huge one and it would be really pathetic if i go ahead and do it manually. I think... (1 Reply)
Discussion started by: amit4g
1 Replies
Login or Register to Ask a Question