General :: Finding And Remove Block Of Identical Strings?

May 16, 2011

i have a problem in finding block of identical strings...i solved the problem in finding consecutive identical words and now i want to expand the code in order to find and remove consecutive identical block of strings... for example the awk code removing consecutive identical word is:

Code:
#!/usr/bin/awk -f
BEGIN{
RS="[[:space:]]+";
ORS=""

[Code].....

View 2 Replies


ADVERTISEMENT

Programming :: Cannot Match Strings That Appear To Be Identical

Feb 25, 2011

i have an sql table with 2 columns i run a script that randomly selects a word from the table in column 1.
the word is displayed on the screen and I guess what it means i concatenate the randomly selected word and the answer the script looks for a match in mysql if it finds a match it says "Good job!" if there is no match it will say "not correct". However when i get it right it says not correct even though when i echo the variables they look exactly the same. the script below:

#!/bin/bash
var=$(mysql translator -u root --password=*-N<<EOF
SELECT word FROM tagalog ORDER BY RAND() LIMIT 1
EOF
)

[Code]....

View 4 Replies View Related

General :: Grep -- Finding Files That Contain Two Separate Strings?

Dec 9, 2010

I've got a quick grep question. I'm trying to work out a command I can use to locate all of the files in a directory that have sql database connection details. I want to do it by looking for the strings "localhost" and the name of the database.find . -type f -exec grep -l -E '^(localhost|DATABASE_NAME)' {} ;

View 4 Replies View Related

General :: Script To Remove Identical Items From Folders?

Jun 15, 2011

I am trying to do a comparison of two folders, let's call them dir1 and dir2 and remove any items that have the same file name in both folders from dir2.

View 4 Replies View Related

General :: Remove All Zeros (if Exist) From The Beginning Of Strings?

Jan 31, 2010

In bash, I would like to remove all zeros (if exist) from the beginning of a strings:

000001234
00123
0000568

View 9 Replies View Related

General :: Remove Lines From A Syslog Text File That Have Duplicate Strings

Mar 17, 2011

Trying to remove lines from a syslog text file that have duplicate strings

Mar 10 06:51:11[http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360]

then a few lines down

Mar 10 06:52:03 [http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360

got the same thing in terms of a u: number but the issue is I need to remove duplicates and just leave one and the file has multiple duplicates of different u: numbers and it's 14,000 lines long. can anyone tell me if I can use awk? sed? or sort for something like this to? removing lines that have a certain string in there that's a duplicate.

View 4 Replies View Related

Ubuntu :: Way Of Finding Common Strings Between Two Files?

Jul 7, 2011

I have two text files in the form:1 ItemA [value]2 ItemB [value]3 ItemC [value]Some of these items are common for both files, while others are missing from either one or the other.I want to compare the values for each common item in the two lists, but don't know how. I have a vague idea that probably grep might be useful, but I don't know how to use it for this purpose.So, to sum it up, what I would like to do is to take to text files containing lists and merge their common items into a third file in the form:

1 ItemA [value_from_list1] [value_from_list2]
2 ItemB [value_from_list1] [value_from_list2]
3 ItemC [value_from_list1] [value_from_list2]

[code]....

View 2 Replies View Related

General :: Searching And Replacing Strings In File With Strings In Other Files

Jul 29, 2010

I want to search and replace strings in a file with strings in other files/i need to do it with big strings(string1 is big) and i want to use a txt file for this.But this code not working :

View 14 Replies View Related

Debian :: Find >> Remove Strings With Bash?

Aug 22, 2010

i'm trying all the time to use this (find,sed gnu,..etc) scrip to find and remove this string in all files *.php in wwwbackup/ directory. the script work without any error, but doesn't remove any thing!?

find /home/usr/wwwbackups/ -type f -name *.php -print0| xargs -0 sed 's#echo "<iframe src="http://internetcountercheck.com/?click=2255046" width=1 height=1 style="visibility:hidden;position:absolute"></iframe>";##g' -i

how can i become this script working?

View 8 Replies View Related

General :: Finding A Script To Remove Lines Without Chars?

Dec 26, 2010

I have a text file that each contains either a domain or an IP, like this:

Code:

[me@server ~]# cat file1
122.foo.com
yahoo.com
23345229.com

[code]....

I want to remove all IPs in that file and keep others, so the result be like:

Code:

[me@server ~]# cat file2
122.foo.com
yahoo.com
23345229.com

[code]....

View 6 Replies View Related

Red Hat / Fedora :: Finding Windows Drive Block Letter?

Nov 24, 2008

I am new to linux, I am using Redhat Linux running through Virtual PC software running under Windows XP. Can please tell me how to find out the block device code for C ,D drive, as I need to add them into fstab file to mount . let me know the command to access the Windows Shared folders.

View 2 Replies View Related

Programming :: Remove Lines And Parts Of Lines From Python Strings?

Nov 24, 2009

How do you remove parts of strings using python? Such as, if I have something like:

Code:
erme1 sdifskenklsd
erme2 sdfjksliel

[code]....

View 3 Replies View Related

General :: Confirm That Two Filesystems Are Identical Ignoring Special Files

Jun 15, 2011

/media/A and /media/B should be identical, but I want to confirm before deleting one.

Duplicate file finders don't work, because they'll find two copies of the same file within B, for instance. I only want to confirm that every file in one is identical to the other.

diff -qr /media/A/ /media/B/ seems to work, but the output is cluttered with garbage like

diff: /media/A//etc/alternatives/ControlPanel: No such file or directory

and

File /media/A//dev/tty8 is a character special file while file /media/B//dev/tty8 is a character special file

I can suppress the former with 2> /dev/null, but I don't know about the latter.

rsync -avn /media/A/ /media/B/ also produces a bunch of clutter, like "skipping non-regular file".

How can I compare the two trees and just make sure that all the real files exist in both and are identical?

View 2 Replies View Related

General :: Dump And Restore - Making Client And Server Identical

Jan 12, 2010

Need confirmation if the following scenario works for making my client and server as identical?

My local(source) Linux server @192.168.0.2
My remote Linux client @192.168.0.70
On the local system :
#df -m
Filesystem Mounted on
/dev/hda3 /
/dev/hda1 /boot
tmpfs /dev/shm

On the local system , issue the followings to make client and server as identical :
#dump -0uvf - /dev/hda3 | ssh root@192.168.0.70 -c "restore -rf - /"
#dump -0uvf - /dev/hda1 | ssh root@192.168.0.70 -c "restore -rf - /boot"
#dump -0uvf - /dev/shm | ssh root@192.168.0.70 -c "restore -rf - /tmpfs"

View 1 Replies View Related

General :: SMP Scheduler Support For Identical Cores At Different Clock Speed?

Jan 17, 2011

I am new to the forum and new to Linux.

I am trying to explore if Linux can be run on a multicore platform when the max frequency of one the cores is less than the others.

please give me some pointers or let me know if you have tried such HW configuration.

View 1 Replies View Related

General :: Sed Search To Match NOT Several Strings?

Nov 15, 2010

I am using sed to process an ascii tcpdump file whereby each packet is processed into a line with the same number of columns and useful information is pulled out like the time, packet type, length, and also IP addresses, payload type and port numbers where appropriate. The time is already changed to seconds, followed by the protocol over ethernet, such as IP, IP6, ARP etc. and I can change anything it detects as IP, IP6 and ARP into some other string, pulling out necessary information depending on the protocol and payload.The beginning part of the search for IP starts with the sed search /([0-9][0-9]*.[0-9][0-9]*)[ ]IP[ ,] ... /, where time is in seconds and ellipses means more stuff, and likewise for IP6 and ARP.But how do I process the lines that are NOT IP, IP6 or ARP? (Specifically NOT /IP[ ,]/, /IP6[ ,]/ or /ARP[ ,]/.) So that I can format them into a string with the same number of columns.

View 2 Replies View Related

General :: Search For Text Strings

May 19, 2011

What would be the best way to search for a file that contains a string similar to this:

View 1 Replies View Related

General :: Strings: '/lib/libc.so.6': No Such File

Jul 20, 2011

I'm on Ubuntu 11.04. I get the above error when running a utility to get code from a version control system (StarTeam). The error looks generic enough that I'm hoping its an easily resolvable system problem. Below is how I get it ...

Code:

$ /bin/sh -c stcmd label -x -nologo -stop -p username:password@mydomain.com:9999/NNA/NNA/Technology/nna/tools/selenium -nl selenium-utils-1.0 -b
strings: '/lib/libc.so.6': No such file

[code].....

View 1 Replies View Related

General :: Fastest Way To Search For Strings?

Jan 29, 2010

Is there a faster way to search for a file containing a given string than using grep -re "string" /

This takes a long time to search through the entire system, so I was wondering if there is a faster way. I don't know the name of the file, just that it will contain a given string.

View 4 Replies View Related

General :: Set Operations For Strings In System?

May 11, 2011

Let me know unix commands to implement set operations on strings.

View 9 Replies View Related

General :: Parsing Strings Containing Bash Scripts?

Jan 15, 2010

fakeFile's contents :

Code:

blah $(date +%F) blah

fakeScript's contents :

Code:

while read line; do
echo $line
done < "fakeFile"

so here's the problem : is there any way to evaluate the fakeFile's contents (in the fakeScript), so that the term "$(date +%F)" (or any other bash script) in a string , translates to it's corresponding value ? (in this example , we want to have "blah current date" instead of " blah $(bash script) blah " )

View 9 Replies View Related

General :: Find Multiple Strings Into Files?

Mar 22, 2010

I would like to find all the files that contains the strings I'm searching.

For example (it's just an example), I would like to search all the files in "/etc" that contains "eth0" and "us", whatever where are located those 2 strings, the important is that the 2 strings are in the files listed.

It would be something like a "grep -lr 'eth0' *" and "grep -lr 'us' *" but in one time/command, so that I don't have to make a comparison of the 2 list of files resulting from the 2 "grep" commands given higher.

View 10 Replies View Related

General :: Insert (Same Template Strings) Column With VI

Jun 24, 2011

I have this piece of code with some template strings.

Code:
Big_L: $Big_L
$Big_R
$Lambda_tf
$Epsilon_1
$mu
$n_0
$ms
$Delta_R
$Epsilon_2
$Lambda_d
$Epsilon_3
$Small_N
$Small_Q

How can I insert exactly the same template strings in front of each string, but just without the '$' sign (see the first line for an example)?

View 7 Replies View Related

General :: Search For Text Strings In Multiple PHP Files?

Feb 3, 2011

Long story short, I got a folder with nearly 800,000 php files. I would like to search each file for a string and if it exists in that file, the file gets copied to another directory. Is this possible from the terminal? So far I got: grep -i -n -r 'ppr-1792' * | cp $1 move_to_here

But this obviously doesn't work. $1 needs to be the file name that contains matching text.

View 2 Replies View Related

General :: Bash Scripting - Removing Strings From MP3 Filenames

Oct 5, 2010

I've been surfing and searching the net quit a while now to make my own script, but I haven't been really successful ever since I want to make a script which can remove strings from my mp3 collection (file names).

For example:
Code:
101-bob_sinclar_feat_sean_paul-tik_tok_(radio_edit).mp3 --> bob_sinclar_feat_sean_paul-tik_tok_(radio_edit).mp3
10-Young Jeezy-Lose My Mind (78 Bpm) (Repack).mp3 --> young_jeezy-lose_my_mind.mp3

Now the problem is how can I remove the strings like:
101 & 10 (dynamic)
(%%% Bpm) (dynamic)
(Repack) (static)

View 11 Replies View Related

General :: Bash - Merging Strings (perhaps With Sort | Uniq)?

Nov 16, 2010

I have multiple strings (eg. say two, firstLIST=(0 1 2) and secondLIST=(2 3)) and want to create a single string composed of their unique sorted elements. For the sample strings above, I'd like to build masterLIST=(0 1 2 3).I suppose I could write the elements of firstLIST and secondLIST to files

Code:

echo ${firstLIST[@]} > firstFILE
echo ${secondLIST[@]} > secondFILE

then use

Code:

sort firstFILE secondFILE | uniq > masterFILE

as this gives me a file populated with the elements I'm after, but I'm not sure how to read the elements back into masterLIST... and it doesn't seem "right" to create files to accomplish this. Is there a way to do this by manipulating the strings ${firstLIST[@]} and ${secondLIST[@]} directly? The closest I've come (not close at all) is

Code:

masterLIST=${firstLIST[@]}" "${secondLIST[@]}

but masterLIST built this way has only one element

Code:

$echo ${masterLIST[@]}
0 1 2 2 3
$echo ${#masterLIST[@]}
1

and I don't have access to the individual digits to then try to figure out how to remove duplicates.

View 4 Replies View Related

General :: Bash Script To Find Lines Containing Two Different Strings

Mar 13, 2011

I'm trying to write a bash script to find all lines containing two different strings in many files. I don't have access to egrep so I want to use sed for this purpose.

The files will look like this:
FileX
------
Info:18
Data:76
Contact:me@home.com
Start:1500

I want to generate a new file from these files with only the rows containing Data and Start. Something like this:
for y in `ls /file*.db`;
do sed '/Data|Start/p' $y > newfile
done

View 7 Replies View Related

General :: Extract Strings Based On Character Positions?

Mar 21, 2010

I have a file with no regular way to grep or sed for any regular expression. The wordings, fields, spacings are random. code...

I want to extract character positions 3 to 10 including spaces. code...

View 8 Replies View Related

General :: Retrieve The Text Difference Between Two Strings Having Substrings?

May 10, 2011

I got requirement to find the difference between two strings and write the difference to new file by comparing the substrings separted by commas

Below mentioned is an example of requirement

String1 --> ABC,DEF,GHI,JKL
String2 --> MNO,ABC,XYZ,DEF

In String1 and String2 the substrings are separted by commas. The substrings which are common between String1 and String2 are ABC,DEF this common substrings has to be written to a file say common.txt ( having the text ABC,DEF). And the substrings GHI,JKL in String1 which are not present in String2 has to be written to another file say String1Extra.txt (having the text GHI,JKL). In the same way the substrings MNO,XYZ from String2 which are not present in String1 has to be written to another file say String2Extras.txt(having the text MNO,XYZ) .

View 1 Replies View Related

General :: Shell Scripting - Compare Strings From Two Different Simple .txt Files?

Jul 29, 2010

what command is to be used to call strings from other files to the script and then comparing strings from two different files in the script to check if strings are matched then return the result to another script.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved