11-10-2009
if it is not perl, then use this.
cat abc.txt
timestamp=2009-11-10-04.55.20.829347;
a;
b;
c;
ddaa;
timestamp=2009-11-10-04.55.20.829347;
aa;
bb;
cc;
$cat abc.txt|awk '{if ( $0 ~ /time/ ) print "|"$0; else print $0}'|tr -d '\n'
|timestamp=2009-11-10-04.55.20.829347;a;b;c;ddaa;|timestamp=2009-11-10-04.55.20.829347;aa;bb;cc;
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyon,
I am trying to search for a pattern in a file and add "//" to the begining of the file.
lets say i want to comment out a line from my codes. the line that should be commented out contains the word "reset". i need to search for the word "reset" and comment out that specific line. is... (5 Replies)
Discussion started by: ROOZ
5 Replies
2. Shell Programming and Scripting
Hi Forum,
Im trying to write some code to read a file, take a certain dynamic value and write it back to the file at the front of every line.
For example, file.txt is:
SIMPLE=HELLO
CONFIDENTIAL=false
SENDER=false
REQUIRED=true
FEEDBACK=false
UPDATE=false
REQUIRED=false
MAPPING=true... (9 Replies)
Discussion started by: ocelot
9 Replies
3. Shell Programming and Scripting
Hi,
Can anybody help me how to add a word in front of a line in a file.Actually it is bit tricky to add a word. i will give a sample for this:
Input :
1110001 ABC DEF
1110001 EFG HIJ
1110001 KLM NOP
1110002 QRS RST
1110002 UVW XYZ
Output:
%HD% 1110001 ABC DEF
%DT% 1110001 EFG HIJ... (4 Replies)
Discussion started by: apjneeraj
4 Replies
4. Shell Programming and Scripting
Hi ,
how to add the single digit to front of the word and front of the lines in the one file with compare pattern file and get digit. like example
pattern file pattern.txt
pattern num
bala 2
raja 3
muthu 4
File Name: chennai.dat
muthu is good boy
raja is bad boy
selvam in super... (6 Replies)
Discussion started by: krbala1985
6 Replies
5. Shell Programming and Scripting
Hi
I've one file full of paths of certain files and I want to add some extra file words in front of all the paths. for eg:
i have a file name test.txt which show some details only..
024_hd/044/0344eng.txt
035_bv/222/editor.jpg
here I want to add /usr/people/indiana/ infront of all the... (4 Replies)
Discussion started by: ratheeshp
4 Replies
6. UNIX for Dummies Questions & Answers
I have a file and some records may contain double quotes at beginning and at end of line. So how do I strip them?
For Example, file is somethings like this
Field1;Field2;Field3
01;'Test';'Test Field3'
"01;'This is 2nd field';This is 3rd field' "
Desired Output is:
... (6 Replies)
Discussion started by: vx04
6 Replies
7. Linux
Please help to provide command in vi to add \ in front of $ so it does not interpret next character.
rm interfaces/DART/WEB-INF/classes/DART/util/TotalDisconnectUtil$1.class
rm interfaces/DART/WEB-INF/classes/DART/util/TotalDisconnectUtil$2.class
rm... (3 Replies)
Discussion started by: ywu081006
3 Replies
8. Shell Programming and Scripting
I am just trying to add specific text in front of a ${variant} but can not seem to get the syntax correct.
I have tried sed -i '$a NM_004004.5' ${variant} and printf "NM_004004.5:%s\n" ${variant} with no luck.
Thank you :). (7 Replies)
Discussion started by: cmccabe
7 Replies
9. Shell Programming and Scripting
Hello Gurus,
I wanted to put a single quote in every where starting with /oradata, and at the end with .dbf.
For example I have one line as below:
alter database rename datafile /oradata/test.dbf to /oradata_new/test.dbf I wanted as below
alter database rename datafile '/oradata/test.dbf' to... (3 Replies)
Discussion started by: pokhraj_d
3 Replies
10. UNIX for Beginners Questions & Answers
Hi,
Hope you are all doing fine.
The problem today i faced during my coding was i wanted to add a space equals to a tab character in front of all the lines which i am cat using tee command.
Main file contents
mainfile
... (4 Replies)
Discussion started by: mad man
4 Replies
LEARN ABOUT CENTOS
sd_journal_get_monotonic_usec
SD_JOURNAL_GET_REALTIME_USEC(3) sd_journal_get_realtime_usec SD_JOURNAL_GET_REALTIME_USEC(3)
NAME
sd_journal_get_realtime_usec, sd_journal_get_monotonic_usec - Read timestamps from the current journal entry
SYNOPSIS
#include <systemd/sd-journal.h>
int sd_journal_get_realtime_usec(sd_journal* j, uint64_t* usec);
int sd_journal_get_monotonic_usec(sd_journal* j, uint64_t* usec, sd_id128_t* boot_id);
DESCRIPTION
sd_journal_get_realtime_usec() gets the realtime (wallclock) timestamp of the current journal entry. It takes two arguments: the journal
context object and a pointer to a 64-bit unsigned integer to store the timestamp in. The timestamp is in microseconds since the epoch, i.e.
CLOCK_REALTIME.
sd_journal_get_monotonic_usec() gets the monotonic timestamp of the current journal entry. It takes three arguments: the journal context
object, a pointer to a 64-bit unsigned integer to store the timestamp in, as well as a 128-bit ID buffer to store the boot ID of the
monotonic timestamp. The timestamp is in microseconds since boot-up of the specific boot, i.e. CLOCK_MONOTONIC. Since the monotonic clock
begins new with every reboot, it only defines a well-defined point in time when used together with an identifier identifying the boot. See
sd_id128_get_boot(3) for more information. If the boot ID parameter is passed NULL, the function will fail if the monotonic timestamp of
the current entry is not of the current system boot.
Note that these functions will not work before sd_journal_next(3) (or related call) has been called at least once, in order to position the
read pointer at a valid entry.
RETURN VALUE
sd_journal_get_realtime_usec() and sd_journal_get_monotonic_usec() returns 0 on success or a negative errno-style error code. If the boot
ID parameter was passed NULL and the monotonic timestamp of the current journal entry is not of the current system boot, -ESTALE is
returned by sd_journal_get_monotonic_usec().
NOTES
The sd_journal_get_realtime_usec() and sd_journal_get_monotonic_usec() interfaces are available as a shared library, which can be compiled
and linked to with the libsystemd-journal pkg-config(1) file.
SEE ALSO
systemd(1), sd-journal(3), sd_journal_open(3), sd_journal_next(3), sd_journal_get_data(3), sd_id128_get_boot(3), clock_gettime(2),
sd_journal_get_cutoff_realtime_usec(3)
systemd 208 SD_JOURNAL_GET_REALTIME_USEC(3)