Sponsored Content
Top Forums Shell Programming and Scripting Extended replacing of nonspecific strings in text files [beware complicated !] Post 302527110 by pasc on Thursday 2nd of June 2011 12:19:37 PM
Old 06-02-2011
Ok, I will try your perl script later on my linux portion of my pc Smilie.

Thanks a ton ! (Just out of curiosity, since perl is the only thing you coded and you can't code in awk, is a sed shell operation viable here ? I guess no, but still xD)

Like I said, the script provided won't fix my problem (since its written in perl), however I found another way to get this fixed:

I found out the lines of the plist that need to be changed and then used this:

53 = line number
VARIABLE = Text that will completly replace the line
Code:
 sed --in-place "53cVARIABLE" Bookmarks.plist

That works really well, because the line positions won't change in my file and I just replace them as whole Smilie.

Still, gotta love this forum, getting an answer to such a complex problem sure rocks ^^.
 

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
CTYPE_UPPER(3)								 1							    CTYPE_UPPER(3)

ctype_upper - Check for uppercase character(s)

SYNOPSIS
bool ctype_upper (string $text) DESCRIPTION
Checks if all of the characters in the provided string, $text, are uppercase characters. PARAMETERS
o $text - The tested string. RETURN VALUES
Returns TRUE if every character in $text is an uppercase letter in the current locale. EXAMPLES
Example #1 A ctype_upper(3) example (using the default locale) <?php $strings = array('AKLWC139', 'LMNSDO', 'akwSKWsm'); foreach ($strings as $testcase) { if (ctype_upper($testcase)) { echo "The string $testcase consists of all uppercase letters. "; } else { echo "The string $testcase does not consist of all uppercase letters. "; } } ?> The above example will output: The string AKLWC139 does not consist of all uppercase letters. The string LMNSDO consists of all uppercase letters. The string akwSKWsm does not consist of all uppercase letters. NOTES
Note If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val- ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain- ing the decimal digits of the integer. SEE ALSO
ctype_alpha(3), ctype_lower(3), setlocale(3). PHP Documentation Group CTYPE_UPPER(3)
All times are GMT -4. The time now is 07:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy