Sponsored Content
Operating Systems Solaris How to find and replace a string? Post 302791677 by hadimotamedi on Tuesday 9th of April 2013 12:33:13 AM
Old 04-09-2013
How to find and replace a string?

Dear All
I need to find and replace a string in a set of files. I try as :
Code:
#find / -name "*"|xargs grep "Tektra"|grep -v "Tektra GSM BTS"

But it doesn't work. It just finds the string in the files. I need to find and replace it.Can you please let me know how to correct it?
Thank you

Last edited by Corona688; 04-09-2013 at 01:00 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

how to find and replace string

hi I wanted to find this char " ^M " in my file and replace it with blank space. I am using Unix system. If i give command " :%s/^M//gc " it wont work so can anyone tell what is command to find and replace thankx (3 Replies)
Discussion started by: mridula
3 Replies

2. UNIX for Dummies Questions & Answers

Find and replace a string in multiple files

I used the following script cd pathname for y in `ls *`; do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y; done and it worked fine for finding and replacing strings with names etc. in all files of the given path. I'm trying to replace a string which consists of path (location of file) ... (2 Replies)
Discussion started by: pharos467
2 Replies

3. UNIX for Dummies Questions & Answers

Find and replace character in a string

Hi all, My problem is the following: I've a script that must list all files in a directory and write this information in a text file. I've tried to get the list through ls command and then write it using msgecho msgecho "`ls $PATH_APS_JOB_ORA`" This works good but the created string... (7 Replies)
Discussion started by: callimaco0082
7 Replies

4. Shell Programming and Scripting

Find the position of a string and replace with another string

Hi, I have a file named "Test_2008_01_21" The file contains a string "manual" that occurs many times in the file How can i find the positions of the string "manual" in the file Ex: if the string " manual " occurs three times in the file. i want to replace the second occurance of string... (6 Replies)
Discussion started by: bab123
6 Replies

5. UNIX for Dummies Questions & Answers

Find, Replace & Edit a string?

Is this something SED would be used for or can AWK do it? I have a string that I would like to chop bits out of and re-arrange some of the rest. Basically I want to change this: <log4j:event logger="webserver" timestamp="1240110840109" time="Sun Apr 19 04:14:00 BST 2009" level="INFO"... (4 Replies)
Discussion started by: Sepia
4 Replies

6. Shell Programming and Scripting

Using sed in ksh to find and replace string

Hi All, I have a file in which contains location of various data files. I want to change locations using sed. Find and replace strings are in a separate file. Content of this file (/tmp/tt) - /dd/pp/test/test/1/ /pp/aa/test/dg1/ /dd/pp/test/test/2/ /pp/aa/test/dg2/ /dd/pp/test/test/3/... (2 Replies)
Discussion started by: pandeyra
2 Replies

7. Shell Programming and Scripting

find string and replace with string in other file

Dear all, I need your help, I have file like this: file1:23456 01910964830098775635 34567 01942809546554654323 67589 26546854368698023653 09778 58716868568576876878 08675 86178546154065406546 08573 54165843543054354305 . .file2: 23456 25 34567 26 67589 27 (2 Replies)
Discussion started by: attila
2 Replies

8. Shell Programming and Scripting

HPUX find string in directory and filetype and replace string

Hi, Here's my dilemma. I need to replace the string Sept_2012 to Oct_2012 in all *config.py files within the current directory and below directories Is this possible? Also I am trying to find all instances of the string Sept_2012 within files in the current directory and below I have... (13 Replies)
Discussion started by: pure_jax
13 Replies

9. Shell Programming and Scripting

How to find and replace a string with spaces and / recursively?

Hi all, I wanted to find and replace an email id from entire directory structure on a Linux server. I found that find . -type f -print0 | xargs -0 sed -i 's/abc@yahoo.com/xyz@gmail.com/g' would do it perfectly. But my search criteria has extended and now I want to search for a string1 like... (2 Replies)
Discussion started by: pat_pramod
2 Replies

10. UNIX for Dummies Questions & Answers

Find and Replace string in UNIX

Hi All, Greetings. I have a .dat file which somewhere in its content contains symbol ""^ I want to replace it with "^ I tried with SED command but could not achieve what i wanted sed -e "s/'""^'/'"^'/ig" filename.dat (5 Replies)
Discussion started by: MaddyS
5 Replies
XAR(1)								   User Commands							    XAR(1)

NAME
xar - eXtensible ARchiver SYNOPSIS
xar -[ctx][v] ... DESCRIPTION
The XAR project aims to provide an easily extensible archive format. Important design decisions include an easily extensible XML table of contents (TOC) for random access to archived files, storing the TOC at the beginning of the archive to allow for efficient handling of streamed archives, the ability to handle files of arbitrarily large sizes, the ability to choose independent encodings for individual files in the archive, the ability to store checksums for individual files in both compressed and uncompressed form, and the ability to query the table of content's rich meta-data. FUNCTIONS
One of the following options must be used: -c Creates an archive -t Lists the contents of an archive -x Extracts an archive NOTE: all of the above require the use of the -f option (filename) as this release of xar doesn't correctly handle pipes or sockets. -f The filename to use for creation, listing or extraction. With extraction, this can be a POSIX regular expression. OPTIONS
--compression Specifies the compression type to use. Valid values: none, gzip, bzip2, lzma (on some systems). Default value: gzip -C <path> On extract, xar will chdir to the specified path before extracting the archive. -a Synonym for --compression=lzma -j Synonym for --compression=bzip2 -z Synonym for --compression=gzip --compression-args=<arguments> Specifies arguments to the compression engine selected. gzip, bzip2, and lzma all take a single integer argument between 0 and 9 specifying the compression level to use. --dump-toc=<filename> Has xar dump the xml header into the specified file. "-" can be specified to mean stdout. --dump-header Has xar print out the xar binary header information to stdout. --extract-subdoc=<name> Extracts the specified subdocument to a document in cwd named <name>.xml --list-subdocs List the subdocuments in the xml header --toc-cksum Specifies the hashing algorithm to use for xml header verification. Valid values: md5 (on some systems), sha1, sha256, and sha512. Default value: sha1 --file-cksum Specifies the hashing algorithm to use for file content verification. Valid values: md5 (on some systems), sha1, sha256, and sha512. Default value: sha1 -l On archival, stay on the local device. -P On extract, set ownership based on uid/gid. If the uid/gid can be set on the extracted file, setuid/setgid bits will also be pre- served. -p On extract, set ownership based on symbolic names, if possible. If the uid/gid can be set on the extracted file, setuid/setgid bits will also be preserved. -s <filename> On extract, specifies the file to extract subdocuments to. On archival, specifies an xml file to add as a subdocument. -v Verbose output --exclude Specifies a POSIX regular expression of files to exclude from adding to the archive during creation or from being extracted during extraction. This option can be specified multiple times. --rsize Specifies a size (in bytes) for the internal libxar read buffer while performing I/O. --coalesce-heap When multiple files in the archive are identical, only store one copy of the data in the heap. This creates smaller archives, but the archives created are not streamable. --link-same When the data section of multiple files are identical, hardlink them within the archive. --no-compress Specifies a POSIX regular expression of files to archive, but not compress. The archived files will be copied raw into the archive. This can be used to exclude already gzipped files from being gzipped during the archival process. --prop-include Specifies a file property to be included in the archive. When this option is specified, only the specified options will be included. Anything not specifically included with this option will be omitted. This option can be used multiple times. --prop-exclude Specifies a file property to be excluded from the archive. When this option is specified, all file properties will be included except the specified properties. This option can be used multiple times. --distribution Creates an archive to only contain file properties safe for file distribution. Currently, only name, type, mode, and data are pre- served with this option. --keep-existing Does not overwrite existing files during extraction. Keeps any previously existing files while extracting. -k Synonym for --keep-existing. --keep-setuid When extracting without -p or -P options, xar will extract files as the uid/gid of the extracting process. In this situation, xar will strip setuid/setgid bits from the extracted files for security reasons. --keep-setuid will preserve the setuid/setgid bits even though the uid/gid of the extracted file is not the same as the archived file. EXAMPLES
xar -cf sample.xar /home/uid Create a xar archive of all files in /home/uid xar -tf sample.xar List the contents of the xar archive sample.xar xar -xf sample.xar Extract the contents of sample.xar to the current working directory BUGS
Doesn't currently work with pipes or streams. Might be fixed in a future release. Probably one or two more somewhere in there. If you find one please report it to http://code.google.com/p/xar/ AUTHORS
Rob Braun <bbraun AT synack DOT net> Landon Fuller <landonf AT bikemonkey DOT org> David Leimbach Kevin Van Vechten version 1.8 June 4, 2015 XAR(1)
All times are GMT -4. The time now is 10:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy