12-04-2018
Replace String matching wildcard pattern
Hi,
I know how to replace a string with another in a file.
But, i wish to replace the below string pattern
EncryptedPassword="{gafgfa}]\asffafsf312a" i.e EncryptedPassword="<any random string>"
To
EncryptedPassword=""
i.e remove the random password to a empty string.
Can you please let me know how can I achieve this ?
Last edited by mohtashims; 12-04-2018 at 07:38 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Here is what I want to do
I want to search local directory and its sub directory, all the files which contain any string like _12345, then remove this string.
String is a combination of _ plus a random integer number.
For example, here is one line in a file before
<properties... (1 Reply)
Discussion started by: bp5000
1 Replies
2. Shell Programming and Scripting
Hi
I am having a csv file in which lots of data are available wherein i need to find a particular kind of data and replace it with null value.
here is the sample data..
I need to find the string starting with 404-064- and up to the first space i have to remove the data and keep the... (4 Replies)
Discussion started by: aemunathan
4 Replies
3. UNIX for Dummies Questions & Answers
Toby> cat sample1
This is some arbitrary text before var1, This IS SOME DIFFERENT ARBITRARY TEXT before var2
Toby> sed -e 's/^This .* before //' -e 's/This .* before //' sample1
var2
I need to convert the above text in sample1 so that the output becomes
var1, var2
by... (2 Replies)
Discussion started by: TobyNorris
2 Replies
4. Shell Programming and Scripting
My example file is as given below:
conn=1 uid=oracle
conn=2 uid=db2
conn=3 uid=oracle
conn=4 uid=hash
conn=5 uid=skher
conn=6 uid=oracle
conn=7 uid=mpalkar
conn=8 uid=anarke
conn=9 uid=oracle
conn=1 op=-1 msgId=-1 - fd=104 slot=104 LDAPS connection from 10.10.5.6 to 10.18.6.5
conn=2... (4 Replies)
Discussion started by: sags007_99
4 Replies
5. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
6. Shell Programming and Scripting
Hi
I want to find a line in a file which contains a word and replace the patterns.
Sample file content temp.xml
====================
<applications>
<application>
Name="FirstService"
location="http://my.website.selected/myfirstService/V1.0/myfirst.war"
... (1 Reply)
Discussion started by: sakthi.99it
1 Replies
7. Shell Programming and Scripting
The sample file:
dept1: user1,user2,user3
dept2: user4,user5,user6
dept3: user7,user8,user9
I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Discussion started by: urello
8 Replies
8. Shell Programming and Scripting
Hi Team,
I am facing a problem as under, Suppose I have a file (test.txt) with the below content (all braces and slashes are included in the contents of the file)
Now I want to append few words below matched line, I have written the below sed:
sed '/option/a insert text here' test... (2 Replies)
Discussion started by: ankur328
2 Replies
9. Programming
I've been having problems lately trying to do pattern matching in C while implementing wildcards. Take for instance the following code:
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h> ... (14 Replies)
Discussion started by: Azrael
14 Replies
10. Shell Programming and Scripting
Can anyone help me with sed or awk to do a bulk replace of the below requirements.
"REC_ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (
START WITH +7486
INCREMENT BY +1
MINVALUE +7467
MAXVALUE... (6 Replies)
Discussion started by: ilugopal
6 Replies
LEARN ABOUT LINUX
git-replace
GIT-REPLACE(1) Git Manual GIT-REPLACE(1)
NAME
git-replace - Create, list, delete refs to replace objects
SYNOPSIS
git replace [-f] <object> <replacement>
git replace -d <object>...
git replace -l [<pattern>]
DESCRIPTION
Adds a replace reference in refs/replace/ namespace.
The name of the replace reference is the SHA-1 of the object that is replaced. The content of the replace reference is the SHA-1 of the
replacement object.
The replaced object and the replacement object must be of the same type. This restriction can be bypassed using -f.
Unless -f is given, the replace reference must not yet exist.
There is no other restriction on the replaced and replacement objects. Merge commits can be replaced by non-merge commits and vice versa.
Replacement references will be used by default by all Git commands except those doing reachability traversal (prune, pack transfer and
fsck).
It is possible to disable use of replacement references for any command using the --no-replace-objects option just after git.
For example if commit foo has been replaced by commit bar:
$ git --no-replace-objects cat-file commit foo
shows information about commit foo, while:
$ git cat-file commit foo
shows information about commit bar.
The GIT_NO_REPLACE_OBJECTS environment variable can be set to achieve the same effect as the --no-replace-objects option.
OPTIONS
-f, --force
If an existing replace ref for the same object exists, it will be overwritten (instead of failing).
-d, --delete
Delete existing replace refs for the given objects.
-l <pattern>, --list <pattern>
List replace refs for objects that match the given pattern (or all if no pattern is given). Typing "git replace" without arguments,
also lists all replace refs.
CREATING REPLACEMENT OBJECTS
git-filter-branch(1), git-hash-object(1) and git-rebase(1), among other git commands, can be used to create replacement objects from
existing objects.
If you want to replace many blobs, trees or commits that are part of a string of commits, you may just want to create a replacement string
of commits and then only replace the commit at the tip of the target string of commits with the commit at the tip of the replacement string
of commits.
BUGS
Comparing blobs or trees that have been replaced with those that replace them will not work properly. And using git reset --hard to go back
to a replaced commit will move the branch to the replacement commit instead of the replaced commit.
There may be other problems when using git rev-list related to pending objects.
SEE ALSO
git-hash-object(1) git-filter-branch(1) git-rebase(1) git-tag(1) git-branch(1) git(1)
GIT
Part of the git(1) suite
Git 1.8.5.3 01/14/2014 GIT-REPLACE(1)