Sponsored Content
Top Forums Shell Programming and Scripting Extended replacing of nonspecific strings in text files [beware complicated !] Post 302527069 by pasc on Thursday 2nd of June 2011 09:13:49 AM
Old 06-02-2011
I just added something to the text file, please reread it,

It seems your understanding is correct,
when N-N-N-N-N is found it should be replaced and each found instance with the said up there.

that means:

first instance N-N-N-N-N replace with 1234
second instance N-N-N-N-N replace ALSO with 1234

third instance N-N-N-N-N replace with 5678
fourth instance N-N-N-N-N replace ALSO with 5678
and so forth...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing lines in text files

Hi, I have 2 sets of text files. I need to take a field from a certain line in set 1 and put it in the same place in set b. The line appears once per file, in different places but is a set format and has the unique word "ANTENNA" in it and is always 81 characters long. Example from set a: ... (7 Replies)
Discussion started by: Jonny2Vests
7 Replies

2. Shell Programming and Scripting

Find information from complicated strings

Hi experts, I have the file with these lines: var1=thu_13:12:32,var2=Microsoft,var3=240ms,var4=Mozilla/4.0_(sun;_MSIR_3-4;_windows.;_NET_1.1323.53 var1=thu_13:13:32,var2=Microsoft,var3=213ms,var4=Mozilla/4.0_(sun;_MSIR_3-4;_windows.;_NET_1.1323.53... (9 Replies)
Discussion started by: lalelle
9 Replies

3. Shell Programming and Scripting

replacing strings with text from other file

Hi, Im trying to update some properties files with text from another file: file1 user=xyz file2 user= after script file2 user=xyz Im using this reading the $QUARTZURL,ETC... from quartz.properties: echo... (1 Reply)
Discussion started by: mc1392
1 Replies

4. Shell Programming and Scripting

Text strings in files.

Hi all I have two files X.txt and Y.txt. The file format of X.txt is : madras is also the fountainhead of the theosophical movement which spread worldwide . and second file Y.txt is of the format: madra|s|nsubj is|cop also|advmod the|det fountainhead|empty of|prep the|det... (3 Replies)
Discussion started by: my_Perl
3 Replies

5. Shell Programming and Scripting

Search complicated strings on file

Can someone help me? I been figuring out how I can search and extract a complicated search string from a file. The whole string is delimited by a period. And the file where I'm searching is composed of differnt string such as that. For example, I have this search string: and I have a file... (3 Replies)
Discussion started by: Orbix
3 Replies

6. Shell Programming and Scripting

Replacing variable Text between fixed strings

Hello all, This is my first post and I hope you can help me out. I searched for quite some hours now and haven't found a simple solution to my problem. It is as following: I got this file: dl.dropbox.com/u/14586156/stuff/Bookmarks.plist and want to replace the Text between... (9 Replies)
Discussion started by: pasc
9 Replies

7. Shell Programming and Scripting

Finding/replacing strings in some files based on a file

Hi, We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies

8. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

9. Shell Programming and Scripting

Replacing strings in various files

i'm trying to figure out the easiest way to replace a string: pineapple pineapple-reg basketball basketball-reg football foot-reg-ball i'm storing the above in a file called wordstoreplace.txt for each line above, the word in the first column is to be replaced by the word in the second... (4 Replies)
Discussion started by: SkySmart
4 Replies

10. Shell Programming and Scripting

Extended ASCII Characters keep on getting reintroduced to text files

I am working with a log file that I am trying to clean up by removing non-English ASCII characters. I am using Bash via Cygwin on Windows. Before I start I set: export LC_ALL=C I clean it up by removing all non-English ASCII characters with the following command; grep -v $''... (4 Replies)
Discussion started by: lewk
4 Replies
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. Unless -f is given, the replace reference must not yet exist. 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 If an existing replace ref for the same object exists, it will be overwritten (instead of failing). -d Delete existing replace refs for the given objects. -l <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. 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. And of course things may break if an object of one type is replaced by an object of another type (for example a blob replaced by a commit). SEE ALSO
git-tag(1) git-branch(1) git(1) GIT
Part of the git(1) suite Git 1.8.3.1 06/10/2014 GIT-REPLACE(1)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy