Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help me in Search and replace Post 302571714 by rakeshkumar on Tuesday 8th of November 2011 05:08:50 AM
Old 11-08-2011
i am looking for a command which can search for any text ( enable and disable regex because * will be treated as zero or more string ) , the input string may vary from one time to other , this time i have a input string of "**** z0023 **" but next time i may have another string like "****************** my comment****** " so i want to write a script which can handle any type of search and replace requests
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search and replace

hi all, the problem is like this...... i setup a file (Env.txt) which handles all the values. NAME1=xxxxxx, where xxxxx is the value NAME2=xxxxxx GGGGG=uusufu I have 6 files, where i will append the values from env.txt. These files has no specific format. all i want is to append the... (1 Reply)
Discussion started by: tungaw2004
1 Replies

2. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

3. Shell Programming and Scripting

Search and replace

I have a script which has several occurences of statement like command: $UCMDPATH/xyz abc I would like to replace the entire line starting from $UCMDPATH with the ls -ltr command eg: Prior to change:: command: $UCMDPATH/xyz abc After change: command: ls -ltr Is there a way to do... (12 Replies)
Discussion started by: jobbyjoseph
12 Replies

4. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

5. Shell Programming and Scripting

Search and Replace

Hi!!! I have following xml file with 3 sections. aaa1bbb-ccc default aaa1bbbdd default 0 11 23 * * aaa2bbb-ccc default aaa2bbbdd default 0 11 23 * * aaa3bbb-ccc default aaa3bbbdd default 0 15 23 * * (15 Replies)
Discussion started by: tdev457
15 Replies

6. Shell Programming and Scripting

perl search and replace - search in first line and replance in 2nd line

Dear All, i want to search particular string and want to replance next line value. following is the test file. search string is tmp,??? ,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50 tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies

7. UNIX for Dummies Questions & Answers

Search and Replace

I am trying to search and replace using two different files with strict search rules. One file contain some data and the other file contain some numbers as shown below. DataFile.txt >L1_T1 text data... text data.. >L1_T1 text data... text data.. >L1_T1 text data... text data.. ........ (4 Replies)
Discussion started by: Fahmida
4 Replies

8. UNIX for Dummies Questions & Answers

Help with search and replace or search only of / in vi

Hi all, I am editing a config file in vi that has a / on it. At the moment, search and replace looks alright as am able to use a # as a temporary separator, i.e. :,$s#/u01/app#/u02/app#g For doing a search, I have to escape the / do. So if I want to search for /u01/app, I am having to do... (2 Replies)
Discussion started by: newbie_01
2 Replies

9. Shell Programming and Scripting

Vi search and replace

Hi, I need help with search and replace for the following string using vi .. if ];then to if ];then can this be done in one search and replace or need multiple ? Thanks (3 Replies)
Discussion started by: talashil
3 Replies

10. Shell Programming and Scripting

Nested search in a file and replace the inner search

Hi Team, I am new to unix, please help me in this. I have a file named properties. The content of the file is : ##Mobile props east.url=https://qa.east.corp.com/prop/end west.url=https://qa.west.corp.com/prop/end south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies
APT-FILE(1)															       APT-FILE(1)

NAME
apt-file - APT package searching utility -- command-line interface SYNOPSIS
apt-file [ options ] [ action ] [ pattern ] apt-file -f [ options ] search [ file ... ] apt-file -D [ options ] search [ binary-packet.deb ... ] DESCRIPTION
apt-file is a command line tool for searching files in packages for the APT package management system. Some actions are required to run the search: find Alias for search. list List the contents of a package matching the pattern pattern. This action is very close to the dpkg -L command except the package does not need to be installed or fetched. purge remove all Contents-* files from the cache directory. search Search in which package a file is included. A list of all packages containing the pattern pattern is returned. apt-file will only search for filenames, not directory names. This is due to the format of the Contents files it searches. show Alias for list. update Resynchronize the package contents from their sources. The lists of the contents of packages are fetched from the location(s) speci- fied in /etc/apt/sources.list. This command attempts to fetch the Contents-<ARCH>.gz files from remote sources. For downloading these uses either the curl or wget commands as specified in apt-file.conf. OPTIONS
-a, --architecture architecture Sets architecture to architecture. This option is useful if you search a package for a different architecture from the one installed on your system. It determines how the $ARCH variable in sources.list is expanded (but it does not influence the search in any other way). -c, --cache cache-directory Sets the cache directory to cache-directory instead of its default. If executed as non-root user, the default is $HOME/.cache/apt- file with fall-back to /var/cache/apt/apt-file. The latter is also the default if apt-file is called as root. -d, --cdrom-mount cdrom-mount-point Use cdrom-mount-point instead of apt's. -D, --from-deb Use contents of the given .deb archives(s) as patterns. Useful for searching for file conflicts with other packages. Implies -F. -f, --from-file Read patterns from the given file(s), one per line. Use -f - for stdin. This is much faster than invoking apt-file many times. -F, --fixed-string Do not expand search pattern with generic characters at pattern's start and end. -i, --ignore-case Ignore case when searching for pattern. -l, --package-only Only display package name; do not display file names. -N, --non-interactive Skip schemes that are listed in the interactive line in apt-file.conf. This is useful if you want to call 'apt-file update' in cron jobs and skip all schemes that may require user input. -s, --sources-list sources.list Sets the sources.list file to a different value from its default /etc/apt/sources.list. -v, --verbose Run apt-file in verbose mode. -x, --regexp Treat pattern as a (perl) regular expression. See perlreref(1) for details. Without this option, pattern is treated as a literal string to search for. -y, --dummy Run in dummy mode (no action). -h, --help Display a short help screen. CONFIGURATION FILE
The apt-file configuration file can be found in /etc/apt/apt-file.conf. A string expansion is done on several values. See the string expansion section. destination This variable describes how cached files will be named. http | ftp | ssh | rsh | file | cdrom Defines the commands used to fetch files. STRING EXPANSION A sources.list entry is defined as: deb uri dist component1 component2 ... A uri is defined as: proto:/[/][user[:password]@]host[:port][/path] <host> replace with the hostname <port> replace with the port number <uri> replace with full uri <path> replace with full path (relative to / on the host) <dist> replace with distribution name <comp> replace with component name <cache> replace with cache directory <dest> replace with destination expanded value. <cdrom> replace with cdrom-mount-point. BUGS
The cdrom backend has not been tested. Non-release lines in sources.list are not handled by apt-file. There is only one Contents file per distribution that contains all components (i.e. main, contrib, and non-free). Threrefore, apt-file will display search results from all components, even if not all components are included in the sources.list file. When a new line has been added to the sources.list and apt-file update has not been run, apt-file does not print a warning message. Complex regular expressions that match the leading slash may not work correctly. As a workaround, try to pull the leading slash to the beginning of the regular expression. For example, use "/(usr/bin/vim|sbin/lvm)" instead of "/usr/bin/vim|/sbin/lvm". FILES
/etc/apt/sources.list Locations to fetch package contents from. /etc/apt/sources.list.d/ Directory with additional sources.list snippets /etc/apt/apt-file.conf Configuration file for apt-file. SEE ALSO
auto-apt(1), apt-cache(8), apt-cdrom(8), dpkg(8), dselect(8), sources.list(5), apt.conf(5), apt_preferences(5). The APT users guide in /usr/share/doc/apt/ AUTHOR
apt-file was written by Sebastien J. Gross <sjg@debian.org>. May 2003 APT-FILE(1)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy