I am attempting to grep a list of files for a string an and then only extract the 3rd and 4th field of from the line. That's easy. But I want to prefix the line with the filename that the information came from.
for filename in `ls -1 *.txt'
do
grep search_text $filename | awk '{print $3"... (5 Replies)
I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
i have a
filename_1=file1.dat
filename_2=file2.dat
i want to pass the filename in a loop
for((i=1;i<=2;i++)
do
awk{print $1} $filename_$i.dat
done
how should i pass the filename (2 Replies)
Im want to print filename inside loop .. the code im using :-
Filename_1=abc_20090623_2.csv.lk
Filename_2=def_20090623_2.csv.lk
i want to extract filename till .csv eg
Filename_1=abc_20090623_2
Filename_2=def_20090623_2
How can i do this inside the for loop
... (3 Replies)
Hi all,
I have a list of xml file. I need to split the files to a different files when see the <ko> tag.
The list of filename are
B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml
B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml
B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml
... (3 Replies)
Hi,
does anybody knows how to manage, that the filenames are assigned to a variable in a loop afer getting them with set command in a ksh, like:
set B*.txt
i=1
c=$#
x=$((c+1))
echo "$x"
while ] ; do
_ftpfile$i="$"$i
echo "$_ftpfile$i"
i=$((i+1))
done
The first echo returns,... (2 Replies)
Hi all,
I've been tangoing with this one for a couple of days now and I'm still not making any progress.
Basically I'm trying to match three numbers in a string from a text file with matching numbers in a jpeg, and then copying the results to another folder.
Data looks like this:
Model:... (4 Replies)
Hi Experts,
We are developing a script which will wait for the trigger file(with datetime in the trigger file name).
But the problem is when I use 'while' loop to wait for the file, it waits for the filename with wilcard in it that is wait for 'Trigger*.done' file. :eek:
Below is the script
... (4 Replies)
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.
I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice.
Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
LEARN ABOUT OPENSOLARIS
sdp_find_attribute
sdp_find_attribute(3COMMPUTIL) Communication Protocol Parser Utilities Library Functions sdp_find_attribute(3COMMPUTIL)NAME
sdp_find_attribute - find the attribute from the attribute list
SYNOPSIS
cc [ flag...] file... -lcommputil [ library...]
#include <sdp.h>
sdp_attr_t *sdp_find_attribute(sdp_attr_t *attr, const char *name);
DESCRIPTION
The sdp_find_attribute() function searches the attribute list attr for the specified attribute name. If the attribute is found it returns
the pointer to that attribute. Otherwise it returns NULL.
RETURN VALUES
The sdp_find_attribute() function returns the attribute (sdp_attr_t *) on success and NULL when the search fails or when mandatory input
parameters are NULL.
EXAMPLES
Example 1 An (incomplete) SDP description that contains one media section: audio.
m=audio 49170 RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendonly
a=ptime:10000
a=maxptime:20000
/*
* Assuming that above description is parsed using sdp_parse and that
* the parsed structure is in "session" sdp_session_t structure.
*/
sdp_attr_t *ptime;
sdp_attr_t *max_ptime;
sdp_media_t *media = session->s_media;
if ((ptime = sdp_find_attribute(media->m_attr, "ptime")) == NULL)
/* ptime attribute not present */
else if((max_ptime = sdp_find_attribute(media->m_attr,
"maxptime")) == NULL)
/* max_ptime attribute not present */
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO libcommputil(3LIB), sdp_parse(3COMMPUTIL), attributes(5)SunOS 5.11 12 Oct 2007 sdp_find_attribute(3COMMPUTIL)