I make this script that uses "strace" to trace programs. The script looks for files that the program opens. It looks like this
I want to extract the path without the quotes, preferably using grep and cut, but it can be also sed or awk (I just don't know these much). I worked out a regular expression egrep -o "\(\"[^\"]*\"," | cut -f 2 -d \" but then I realized the path can contain characters like " as well.
I thought the solution could look something like this egrep -o "\(\"[^{[^\\]\",[:space:]}]*\"," (any characters except string "[^\\]\",[:space:]" and these characters repeating)... Because I found out that strace doesn't work correctly if "\" without quotes is at the end of the file. So I thought I could use it as a benefit. However, it doesn't work .. I'm not very good in regular expressions indeed.
EDIT: And I'm sorry ... [:space:] is not the solution, because the script should work in FreeBSD as well and it uses "truss" instead of "strace" and there's no space after ",
Last edited by Yogesh Sawant; 03-24-2010 at 11:02 PM..
Reason: added code tags
I need to extract a file,which contains the path to a new path.
sample tar file
tar -tfv class.tar | grep client
-rw------- 0/1 99 Jan 22 12:46 2004 /usr/openv/netbackup/db/class/mariner/clients
-rw------- 0/1 102 Sep 25 11:33 2007... (1 Reply)
Im trying to extract a directory from a path entered by the user
Lets say the path is
path=/home/bliss/files/myfile.txt
i wanna extract "/home/bliss/files" from $path ... how can i do this? (4 Replies)
Hi all,
I know this has been covered a lot, I have been searching and reading for hours on the subject, however so far I have been unsuccessful at accomplishing the goal using sed.
I know this can be done with parameter expansion (Thanks cfajohnson for a great explanation of parameter... (5 Replies)
Hi,
I have a environmental variables,
ORACLE_HOME=/u01/oracle/ORCL/db/tech/10.2.0
ORACLE_SID=ORCL
Now I need to create a variable and need to extract some part from ORACLE_HOME. I need to get the path from ORACLE_HOME till ORACLE_SID as /u01/oracle/ORCL. I may need to check also... (6 Replies)
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
hello,
i have a configuration file app.conf under /tmp, containing values like :
param1=/data/something
param2=/data/somethingelse
i have a bash script that has to list the files under the path that corresponds to param2 :
#!/bin/bash
dir=$(cat tmp/app.conf | grep param2 | sed ... (6 Replies)
Hi all,
i've a string
$DIR=/u/user/NDE/TEST_LOGS/20110622_000005_TEST_11_HD_120/HD/TEST_11_HD_120/hd-12
i need to extract string from 2011.... i.e i need it as 20110622_000005_TEST_11_HD_120 as matched string, and in turn i need to split values 20110622_000005_TEST_11_HD_120 into two.... (6 Replies)
Hi everyone,
I have different folders which looks like this:
/mnt/ecrm/master/ecrm/templates/brochure/de_DE/zeitlos.ott
/mnt/ecrm/master/ecrm/templates/mail/en_US/default.html
/templates/header_and_footer/en_US/default.txt
I want to get the bold text only in a variable. I already have a... (3 Replies)
i was attempting to extract a directory path that was passed from a parameter with this code
vdir=`dirname $p1`
echo current directory $vdir
it does not work when the parameter passed has wild card on it.
for example
$ sh sample1.sh "/sbin/log/c*.log"
dirname: extra operand... (2 Replies)
Discussion started by: wtolentino
2 Replies
LEARN ABOUT XFREE86
strace-log-merge
STRACE-LOG-MERGE(1) General Commands Manual STRACE-LOG-MERGE(1)NAME
strace-log-merge - merge strace -ff -tt output
SYNOPSIS
strace-log-merge STRACE_LOG
strace-log-merge --help
DESCRIPTION
strace-log-merge merges the output of strace -ff -tt[t] command, prepending PID to each line and sorting the result using time stamp as a
key.
OPTIONS --help Show program usage and exit.
STRACE_LOG
Output file name prefix of files produced by a strace -ff -tt[t] command.
EXIT STATUS
0 Success
Non-zero
Error occurred: either no argument specified (in that case a usage is printed), or something went wrong during the processing of
STRACE_LOG.* files.
USAGE EXAMPLE
$ strace -o sleepy -ff -tt -e trace=execve,nanosleep
sh -c 'sleep 0.1 & sleep 0.2 & sleep 0.3'
$ strace-log-merge sleepy | fold -w 72 -s
13475 21:13:52.040837 execve("/bin/sh", ["sh", "-c", "sleep 0.1 & sleep
0.2 & sleep 0."...], 0x7ffde54b2450 /* 33 vars */) = 0
13478 21:13:52.044050 execve("/bin/sleep", ["sleep", "0.3"],
0x5631be4f87a8 /* 33 vars */) = 0
13476 21:13:52.044269 execve("/bin/sleep", ["sleep", "0.1"],
0x5631be4f87a8 /* 33 vars */) = 0
13477 21:13:52.044389 execve("/bin/sleep", ["sleep", "0.2"],
0x5631be4f87a8 /* 33 vars */) = 0
13478 21:13:52.046207 nanosleep({tv_sec=0, tv_nsec=300000000}, NULL) = 0
13476 21:13:52.046303 nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0
13477 21:13:52.046318 nanosleep({tv_sec=0, tv_nsec=200000000}, NULL) = 0
13476 21:13:52.146852 +++ exited with 0 +++
13475 21:13:52.146942 --- SIGCHLD {si_signo=SIGCHLD,
si_code=CLD_EXITED, si_pid=13476, si_uid=1000, si_status=0, si_utime=0,
si_stime=0} ---
13477 21:13:52.247782 +++ exited with 0 +++
13475 21:13:52.247885 --- SIGCHLD {si_signo=SIGCHLD,
si_code=CLD_EXITED, si_pid=13477, si_uid=1000, si_status=0, si_utime=0,
si_stime=0} ---
13478 21:13:52.347680 +++ exited with 0 +++
13475 21:13:52.347786 --- SIGCHLD {si_signo=SIGCHLD,
si_code=CLD_EXITED, si_pid=13478, si_uid=1000, si_status=0, si_utime=0,
si_stime=0} ---
13475 21:13:52.348069 +++ exited with 0 +++
NOTES
strace-log-merge does not work well with strace logs generated by strace -tt invocation that pass midnight, as those lack the information
required for the proper sorting. Employing the -ttt option in the respective strace invocation should solve the problem.
BUGS
strace-log-merge does not perform any checks whether the files specified are in the correct format and implies that only files from a sin-
gle strace session match STRACE_LOG.* glob pattern.
HISTORY
The initial version of strace-log-merge was written by Denys Vlasenko in 2012.
REPORTING BUGS
Problems with strace-log-merge should be reported to the strace mailing list at <strace-devel@lists.sourceforge.net>.
SEE ALSO strace(1)strace UNKNOWN 2018-04-11 STRACE-LOG-MERGE(1)