Sponsored Content
Top Forums Shell Programming and Scripting Search a string and append text after the string Post 302215651 by kesu2k on Thursday 17th of July 2008 12:11:35 AM
Old 07-17-2008
Hi Annihilannic,
I used awk '/rights/,/avsStoreLoc/ { print }' a.xml
to extract the text between "rights" and "avsStoreLoc" ..but it didnt help me much
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. Shell Programming and Scripting

Trying to search for a string and append text only once

Hi I am trying to search for a particular occurrence of a string in a file, and if found, append another string to the end of that line. Here is my file contents: column1 userlist default nowrite=3 output=4 column2 access default nowrite=3 Here is the code: A="user=1... (1 Reply)
Discussion started by: bludhemn
1 Replies

3. Shell Programming and Scripting

Search for a string, then append character to end of that line only

I have 2 files that I am working with $ cat file1 server1 server3 server5 server6 server8 $ cat file2 server1;Solaris; server2; SLES; server3;Linux; server4; Solaris; server5;SLES; server6;SLES; server7;Solaris; server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies

4. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

5. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

6. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

7. Shell Programming and Scripting

Search a string in a text file and add another string at the end of line

Dear All I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies

8. Shell Programming and Scripting

To Search for a string and to extract the string from the text

Hi Team I have an huge xml where i need to search for a ceratin numbers. For example 2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () - <?xml version="1.0" encoding="UTF-8"... (5 Replies)
Discussion started by: Kannannair
5 Replies

9. Shell Programming and Scripting

Need comand or script for append text after searching for the desired string

Hi all, i have a generated report in unix in the following command like input.txt 47.85,10 0124,42.35,8 0125,3.5,2 the input file format is fixed I need the my output file with append text as below output.txt 0124 amount:42.35 0125 amount:3.5 0124 count : 8 0125... (34 Replies)
Discussion started by: hemanthsaikumar
34 Replies

10. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
CAP_RIGHTS_INIT(3)					   BSD Library Functions Manual 					CAP_RIGHTS_INIT(3)

NAME
cap_rights_init, cap_rights_set, cap_rights_clear, cap_rights_is_set, cap_rights_is_valid, cap_rights_merge, cap_rights_remove, cap_rights_contains -- manage cap_rights_t structure LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/capsicum.h> cap_rights_t * cap_rights_init(cap_rights_t *rights, ...); cap_rights_t * cap_rights_set(cap_rights_t *rights, ...); cap_rights_t * cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...); bool cap_rights_is_valid(const cap_rights_t *rights); cap_rights_t * cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); cap_rights_t * cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little); DESCRIPTION
The functions documented here allow to manage the cap_rights_t structure. Capability rights should be separated with comma when passed to the cap_rights_init(), cap_rights_set(), cap_rights_clear() and cap_rights_is_set() functions. For example: cap_rights_set(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT, CAP_SEEK); The complete list of the capability rights can be found in the rights(4) manual page. The cap_rights_init() function initialize provided cap_rights_t structure. Only properly initialized structure can be passed to the remain- ing functions. For convenience the structure can be filled with capability rights instead of calling the cap_rights_set() function later. For even more convenience pointer to the given structure is returned, so it can be directly passed to cap_rights_limit(2): cap_rights_t rights; if (cap_rights_limit(fd, cap_rights_init(&rights, CAP_READ, CAP_WRITE)) < 0) err(1, "Unable to limit capability rights"); The cap_rights_set() function adds the given capability rights to the given cap_rights_t structure. The cap_rights_clear() function removes the given capability rights from the given cap_rights_t structure. The cap_rights_is_set() function checks if all the given capability rights are set for the given cap_rights_t structure. The cap_rights_is_valid() function verifies if the given cap_rights_t structure is valid. The cap_rights_merge() function merges all capability rights present in the src structure into the dst structure. The cap_rights_remove() function removes all capability rights present in the src structure from the dst structure. The cap_rights_contains() function checks if the big structure contains all capability rights present in the little structure. RETURN VALUES
The functions never fail. In case an invalid capability right or an invalid cap_rights_t structure is given as an argument, the program will be aborted. The cap_rights_init(), cap_rights_set() and cap_rights_clear() functions return pointer to the cap_rights_t structure given in the rights argument. The cap_rights_merge() and cap_rights_remove() functions return pointer to the cap_rights_t structure given in the dst argument. The cap_rights_is_set() returns true if all the given capability rights are set in the rights argument. The cap_rights_is_valid() function performs various checks to see if the given cap_rights_t structure is valid and returns true if it is. The cap_rights_contains() function returns true if all capability rights set in the little structure are also present in the big structure. EXAMPLES
The following example demonstrates how to prepare a cap_rights_t structure to be passed to the cap_rights_limit(2) system call. cap_rights_t rights; int fd; fd = open("/tmp/foo", O_RDWR); if (fd < 0) err(1, "open() failed"); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); if (allow_write_and_seek) cap_rights_set(&rights, CAP_WRITE, CAP_SEEK); if (dont_allow_seek) cap_rights_clear(&rights, CAP_SEEK); if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) err(1, "cap_rights_limit() failed"); SEE ALSO
cap_rights_limit(2), open(2), capsicum(4), rights(4) HISTORY
Support for capabilities and capabilities mode was developed as part of the TrustedBSD Project. AUTHORS
This family of functions was created by Pawel Jakub Dawidek <pawel@dawidek.net> under sponsorship from the FreeBSD Foundation. BSD
March 27, 2014 BSD
All times are GMT -4. The time now is 02:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy