10-24-2009
Quote:
cat sample.txt
06.09.2009 18:07:01 Customer login not found: identifier=(0499472147) prefix=(TEL) serviceCode=().
06.09.2009 18:10:37 Customer login not found: identifier=(0499472147) prefix=(TEL) serviceCode=().
06.09.2009 18:10:37 Customer login not found: identifier=(0499472147) prefix=(TEL) serviceCode=().
07.09.2009 06:02:08 Customer login not found: identifier=(0165599574) prefix=(TEL) serviceCode=().
07.09.2009 06:02:08 Customer login not found: identifier=(0165599574) prefix=(TEL) serviceCode=().
07.09.2009 18:20:28 Customer login not found: identifier=(0165599574) prefix=(TEL) serviceCode=().
07.09.2009 18:20:28 Customer login not found: identifier=(0165599574) prefix=(TEL) serviceCode=().
08.09.2009 06:00:52 Customer login not found: identifier=(0499472147) prefix=(TEL) serviceCode=().
08.09.2009 06:00:52 Customer login not found: identifier=(0499472147) prefix=(TEL) serviceCode=().
08.09.2009 06:05:28 Customer login not found: identifier=(0165599574) prefix=(TEL) serviceCode=().
08.09.2009 06:05:28 Customer login not found: identifier=(0165599574) prefix=(TEL) serviceCode=().
08.09.2009 18:12:57 Customer login not found: identifier=(0499472147) prefix=(TEL) serviceCode=().
/usr/people/wrajyasm$ awk -F"[()]" '{print $2}' sample.txt
/usr/people/wrajyasm$
Even then I am not getting any output .Please help.
It works perfectly on Solaris.
Did you try nawk as suggested, or /usr/xpg4/bin/awk?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Experts.
I need to list the file and the filename comes from the file ListOfFile.txt.
Basicly I have a filename "ListOfFile.txt" and it contain
Example of ListOfFile.txt
/home/Dave/Program/Tran1.P
/home/Dave/Program/Tran2.P
/home/Dave/Program/Tran3.P
/home/Dave/Program/Tran4.P... (7 Replies)
Discussion started by: tanit
7 Replies
2. Shell Programming and Scripting
help me pls.. :(
i want to read a mapping file.
Below is the content of my mapping file.
6221,189,SMSC1,OMC1,WAP1
6223,188,SMSC2,OMC2,WAP2
so when my program running
msisdn="622130302310"
while not EOF
if substring($msisdn,1,4) == "6221" -- > "6221" read from the file
then
echo... (0 Replies)
Discussion started by: voidmain
0 Replies
3. Shell Programming and Scripting
i have one file
abhi.txt
its contents are
home8/mc09ats/UnixCw/backup/file1
home8/mc09ats/file2
i want to read this content of file using while loop..
in this i want to seperate the content as follows
path=home8/mc09ats/UnixCw/backup
file=file1
echo path
echo file
can you... (1 Reply)
Discussion started by: AbhijitIT
1 Replies
4. Shell Programming and Scripting
Hello,
I got a Qstion. Im posting to a phpbb forum with bash and curl.. i have a text file with the following tags that i post to the forum:
$var1
$var2
$var3
How can i with sed or awk put var content from shell script between the ... in the... (7 Replies)
Discussion started by: atmosroll
7 Replies
5. Shell Programming and Scripting
Hello,
I trying to extract text that is surrounded by xml-tags. I tried this
cat tst.xml | egrep "<SERVER>.*</SERVER>" |sed -e "s/<SERVER>\(.*\)<\/SERVER>/\1/"|tr "|" " "
which works perfect, if the start-tag and the end-tag are in the same line, e.g.:
<tag1>Hello Linux-Users</tag1>
... (5 Replies)
Discussion started by: Sebi0815
5 Replies
6. Shell Programming and Scripting
I have large number of data files, close to 300 files, lets say all files are same kind and have extension .dat , each file have mulitple lines in it.
There is a unique line in each file containing string 'SERVER'. Right after this line there is another line which contain a string 'DIGIT=0',... (4 Replies)
Discussion started by: sal_tx
4 Replies
7. Shell Programming and Scripting
Hi,
Example File:
(jumped,
bumped,
)
how to
jumped,
FROM tree;
EXIT
I have some hundreads of files like this with the different words and I want to remove the comma before the bracket and also I have to remove the comma before FROM word.
I am trying to use this command :
awk '... (5 Replies)
Discussion started by: rajshashi
5 Replies
8. Shell Programming and Scripting
Ok, so I have a bash script with an embedded expect statement.
Inside of the expect statement, i'm trying to pull all of the non-comment lines from the /etc/oratab file one at a time.
Here's my command:
cat /etc/oratab |sed /^s*#/d\ | awk 'NR==1'|awk -F: '{print \"$1\"}'|. oraenv
Now,... (0 Replies)
Discussion started by: alexdglover
0 Replies
9. Shell Programming and Scripting
Hi,
I am having trouble while using 'sed' with reading files. Please help. I have 3 files. File A, file B and file C. I want to find content of file B in file A and replace it by content in file C.
Thanks a lot!!
Here is a sample of my question.
e.g. (file A: a.txt; file B: b.txt; file... (3 Replies)
Discussion started by: dirkaulo
3 Replies
10. UNIX for Beginners Questions & Answers
Hello everybody,
I would like modify some strings using sed or another command line with the content file.
For example:
- {fqdn: "server-01" , ip: "server-01"}
- {fqdn: "server-02" , ip: "server-02"}
- {fqdn: "server-03" , ip: "server-03"}
- {fqdn: "server-04" , ip: "server-04"}
My... (4 Replies)
Discussion started by: dco
4 Replies
LEARN ABOUT DEBIAN
sd_pid_get_session
SD_PID_GET_SESSION(3) sd_pid_get_session SD_PID_GET_SESSION(3)
NAME
sd_pid_get_session, sd_pid_get_unit, sd_pid_get_owner_uid - Determine session, service or owner of a session of a specific PID
SYNOPSIS
#include <systemd/sd-login.h>
int sd_pid_get_session(pid_t pid, char** session);
int sd_pid_get_unit(pid_t pid, char** unit);
int sd_pid_get_owner_uid(pid_t pid, uid_t* uid);
DESCRIPTION
sd_pid_get_session() may be used to determine the login session identifier of a process identified by the specified process identifier. The
session identifier is a short string, suitable for usage in file system paths. Note that not all processes are part of a login session
(e.g. system service processes, user processes that are shared between multiple sessions of the same user, or kernel threads). For
processes not being part of a login session this function will fail. The returned string needs to be freed with the libc free(3) call after
use.
sd_pid_get_unit() may be used to determine the systemd unit (i.e. system service) identifier of a process identified by the specified
process identifier. The unit name is a short string, suitable for usage in file system paths. Note that not all processes are part of a
unit/service (e.g. user processes, or kernel threads). For processes not being part of a systemd unit/system service this function will
fail. The returned string needs to be freed with the libc free(3) call after use.
sd_pid_get_owner_uid() may be used to determine the Unix user identifier of the owner of the session of a process identified the specified
PID. Note that this function will succeed for user processes which are shared between multiple login sessions of the same user, where
sd_pid_get_session() will fail. For processes not being part of a login session and not being a shared process of a user this function will
fail.
If the pid paramater of any of these functions is passed as 0 the operation is executed for the calling process.
RETURN VALUE
On success these calls return 0 or a positive integer. On failure, these calls return a negative errno-style error code.
NOTES
The sd_pid_get_session(), sd_pid_get_pid(), and sd_pid_get_owner_uid() interfaces are available as shared library, which can be compiled
and linked to with the libsystemd-login pkg-config(1) file.
Note that the login session identifier as returned by sd_pid_get_session() is completely unrelated to the process session identifier as
returned by getsid(2).
SEE ALSO
systemd(1), sd-login(7), sd_session_is_active(3), getsid(2)
AUTHOR
Lennart Poettering <lennart@poettering.net>
Developer
systemd 10/07/2013 SD_PID_GET_SESSION(3)