I'm guessing this is probably relatively straight forward to do in awk, but I just can't get my head round it! I have a log file of the following format:
What I want to do is prepend each line with the current TIMESTAMP, so the above to become:
I'm won't be keeping the TIMESTAMP lines in the final output, so am not worried if the prepended timestamp is these lines is correct or not.
Moderator's Comments:
How to use code tags when posting data and code samples.
Any ideas?
Thanks!!
Last edited by Franklin52; 11-25-2011 at 08:18 AM..
Reason: Code tags
I have a directory name stored in a variable. Does anyone have a piece of code which checks if this stored directory name ends up with the "/" and if it is missing adds it to the same variable. for example I might have
A=/bb/data or A=/bb/data/
which needs to be A=/bb/data/ for sure
thanks... (5 Replies)
Hi
I have a variable which holds full path to the file, for example
z=/bb/data3/f4222pdb.dta.new
I need to remove the extension .new so it would look like
z=/bb/data3/f4222pdb.dta
Is there a command to do this? This variable is used in the "for" loop later. I am in ksh. Thanks a lot -A (4 Replies)
how to print any required line by its line no using awk and its NR variable
for eg:
------------
121343
adfdafd
21213sds
dafadfe432
adf.adf%adf
---------------
requied o/p if give num=3 it print:
21213sds
-------------------------------------- (2 Replies)
Hi,
I'm not an expert in awk but i need a simple script to do this:
I'd like to AutoCrop PDF files.
I found 2 simple script that combined together could help me to automatize :)
The first utiliti is "pdfinfo" that it gives the MediaBox and TrimBox values from the pdf.
The pdfinfo output... (8 Replies)
hello,
I have problem with writing/adjusting a shell script.
I searched forum and unfortunately couldn't write scipt based on the information I found.
I never wtire such so it's hard for me and I do need to modify one script immediately.
case looks like:
1. 'file' that needs to be modified... (3 Replies)
I am using Solaris 10 and have no GNU products installed. I have the following awk code and would like to add a variable. I believe awk doesn't accept variables, but I think nawk can. I would like to replace the red higlighted part of my code with a variable. If nawk is the answer how do I change... (3 Replies)
Hi
I have a text like this
example.input
1 red
2 blue
3 green
If I set this
c=2
Then try
awk 'NR==$c { print $2 }' example.input
I do get nothing
If I try
awk 'NR==2 { print $2 }' example.input
i get
blue (8 Replies)
I have a small program which needs to pass variable dynamically to form the name of a second variable whose value wil be passed on to a third variable.
***************** Program Start ******************
LOC1=/loc1
PAT1IN=/loc2
PAT2IN=/loc3
if ; then
for fpattern in `cat... (5 Replies)
Input:
|Running the Rsync|Sun Oct 16 22:48:01 BST 2016
|End of the Rsync|Sun Oct 16 22:49:54 BST 2016
|Running the Rsync|Sun Oct 16 22:54:01 BST 2016
|End of the Rsync|Sun Oct 16 22:55:45 BST 2016
|Running the Rsync|Sun Oct 16 23:00:02 BST 2016
|End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)