Sponsored Content
Top Forums Shell Programming and Scripting Search for / and insert \ for every instance Post 302837401 by deadyetagain on Thursday 25th of July 2013 04:49:58 PM
Old 07-25-2013
RedHat Search for / and insert \ for every instance

Hi,

I want to do a sed (linux) or the alternative in PHP to insert a backslash in front of every occurrence of every forward slash

ex.

/archive/data/stanley
-->
\/archive\/data\/stanley

I appreciate it!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed search and insert

how can i modify a file using sed when searching for a pattern and insert newline after the pattern? pattern example: $ ...(any characters)...$ $ may082001.../tmp/msg.001,,$ REPT CLEAR ALARMS ON UNIT 1 $ may082001.../tmp/msg.002,,$ UNIT 1 IN SERVICE into: $... (1 Reply)
Discussion started by: apalex
1 Replies

2. Shell Programming and Scripting

Search and insert between Pattrens...

Hi Every One... I wanted to inserted a line in between matched pattrens.. Ex... InPut File.. WRITEQ TS ************************** aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccc SOME PATTREN's RESP ( WS-RESP ) ... (7 Replies)
Discussion started by: pbsrinivas
7 Replies

3. Shell Programming and Scripting

replace first instance(not first instance in line)

Alright, I think I know what I am doing with sed(which probably means I don't). But I cant figure out how to replace just the first occurance of a string. I have tried sed, ed, and grep but can't seem to figure it out. If you have any suggestions I am open to anything! (3 Replies)
Discussion started by: IronHorse7
3 Replies

4. Shell Programming and Scripting

Search the last instance of a string in a file

I have a big database log file which keepsgrowing daily. OS is HP UX. Here is a small part of it: Tue Jan 27 04:03:22 2009 : add session begin for mfgeb on /dev/pts/th. : Converting relative path to absolute path. : add session end. Tue Jan 27 04:03:29... (6 Replies)
Discussion started by: dinesh1178
6 Replies

5. Shell Programming and Scripting

KSH - search for string and insert line above

Hi,, Please excuse my lack of knowledge here. I think I am tring to do something fairly advanced yet am a bit of a beginner..... I want to use a korn shell (as is the norm with others in my company) to write a script to search a file for a string and insert some text above that line. Sudo... (5 Replies)
Discussion started by: HugoDarley
5 Replies

6. Shell Programming and Scripting

Search for last instance of word in a file

Hi I'm trying to search for the last instance of the word 'cache' in a HTML file that I have downloaded from YouTube. I'm using the following syntax, but an error is thrown when I try it. grep -f "cache" Also I wish to append the above grep command to the below so that the search for cache... (3 Replies)
Discussion started by: colmbell
3 Replies

7. Shell Programming and Scripting

sed: how to limit pattern search to first instance only

I need to reduce a file's size below 50MB by deleting chucks of text. The following sed does this. sed '/^begpattern/,/endpattern/d' myfile However, it's possible that the file size can get below 50MB by just deleting the first instance of the pattern. How do I code that into sed? Or can awk... (8 Replies)
Discussion started by: mariod1049
8 Replies

8. Shell Programming and Scripting

Search text file, then grep next instance of string

I need to be able to search for a beginning line header, then use grep or something else to get the very next instance of a particular string, which will ALWAYS be in "Line5". What I have is some data that appears like this: Line1 Line2 Line3 Line4 Line5 Line6 Line7 Line1 Line2 ...... (4 Replies)
Discussion started by: Akilleez
4 Replies

9. Shell Programming and Scripting

Search and Insert

Hi All I got one problem and want your help,what i want to do is Input 123 key0=A;B;C;:key1=X;Y;Z;: here 123 is a username I should search the username (in this case it is 123) in file and if found it should insert the additional string D as below Here 123 and key are tab seperated ... (6 Replies)
Discussion started by: parthmittal2007
6 Replies

10. Shell Programming and Scripting

Search and Insert

I have a following file: # User defined in group admin = boss, sysadmin phpteam = php1, php2, php3 rubyteam = ruby1, ruby2 # SVN root should only be access by boss and system admin @admin = rw * = # Main web repository should only be access by boss and system admin, others... (3 Replies)
Discussion started by: ankur328
3 Replies
elf_getarhdr(3ELF)					       ELF Library Functions						elf_getarhdr(3ELF)

NAME
elf_getarhdr - retrieve archive member header SYNOPSIS
cc [ flag ... ] file ... -lelf [ library... ] #include <libelf.h> Elf_Arhdr *elf_getarhdr(Elf *elf); DESCRIPTION
elf_getarhdr() returns a pointer to an archive member header, if one is available for the ELF descriptor elf. Otherwise, no archive member header exists, an error occurred, or elf was null; elf_getarhdr() then returns a null value. The header includes the following members. char *ar_name; time_t ar_date; uid_t ar_uid; gid_t ar_gid; mode_t ar_mode; off_t ar_size; char *ar_rawname; An archive member name, available through ar_name, is a null-terminated string, with the ar format control characters removed. The ar_raw- name member holds a null-terminated string that represents the original name bytes in the file, including the terminating slash and trail- ing blanks as specified in the archive format. In addition to ``regular'' archive members, the archive format defines some special members. All special member names begin with a slash (/), distinguishing them from regular members (whose names may not contain a slash). These special members have the names (ar_name) defined below. / This is the archive symbol table. If present, it will be the first archive member. A program may access the archive symbol table through elf_getarsym(). The information in the symbol table is useful for random archive processing (see elf_rand() on elf_begin(3ELF)). // This member, if present, holds a string table for long archive member names. An archive member's header contains a 16-byte area for the name, which may be exceeded in some file systems. The library automatically retrieves long member names from the string table, setting ar_name to the appropriate value. Under some error conditions, a member's name might not be available. Although this causes the library to set ar_name to a null pointer, the ar_rawname member will be set as usual. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
ar.h(3HEAD), elf(3ELF), elf_begin(3ELF), elf_getarsym(3ELF), libelf(3LIB), attributes(5) SunOS 5.10 11 Jul 2001 elf_getarhdr(3ELF)
All times are GMT -4. The time now is 06:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy