12
votes
8answers
996 views

Bash Script to repeat every word in a line?

I have a string like: dog cat bird whale And I want to get dog dog cat cat bird bird whale whale All the words are in the same line. Any idea?
0
votes
1answer
30 views

How to locate files within my computer containing strings of text

What I am trying to do: I am trying to locate files with in the directory \\xxxx that contain strings of text DSN=, Server=, UID=, Pwd=, Password=. The files do not have to contain every single ...
0
votes
2answers
53 views

How do different operators deal with a given string

I want to read two strings as parameters to bash script, these strings are meant to be extensions, then I want to replace the extension of files with the first extension to the second extension. The ...
0
votes
2answers
473 views

How to concat String, File Contents, and String in bash script?

I have a file which contains only one line $> cat file.txt apple,orange,cat,dog I need to append two String to it and assign it to a variable, one in front and another in the end, so that it ...
0
votes
0answers
50 views

GNU Screen - String Escapes

Can somebody please explain or point me to good tutorial about "String Escapes" used in ~/screenrc. I am playing with $PS1 and ~/.screenrc. While $PS1 seems pretty clear (colors, conditions, escape ...
0
votes
1answer
394 views

how to replace unknown substring of line with sed

I want to replace a substring in a line, but I don't know what that substring is. I do know how the line starts though. For example, DNS1=[...to be replaced....]. I tried: sed -i ...
-1
votes
2answers
130 views

Change permission on a string of directories

I have a string of directories and i want to change the permission on all of these directories to 775 (rwxrwxr-x) with a command like chmod. The problem is that the string is editable so it can be ...
0
votes
0answers
28 views

How to find the line containing a string in a file? [duplicate]

Possible Duplicate: How to search for a string in a line and return line and line numbers in linux? I have a file myfile. I will search for a string in this file. I want to see the line ...
0
votes
1answer
398 views

How do I find files containing two strings together in Linux? [duplicate]

Possible Duplicate: How to Combine find and grep for a complex search? ( GNU/linux, find, grep ) I have a file containing a text: PADLST20120907:D:05B:UN:IBTA+TK4 17 ...
2
votes
4answers
3k views

How to find files containing two strings together in Linux?

I want to find files containing two strings together, for example the file contains both string1 and string2. I want the full path of files in output. I don't want to see "permission denied" ...
0
votes
3answers
644 views

How to search for a string in a line and return line and line numbers in linux?

I want to search for a string in a file, and the output should give me the line number and line containing that string. How can I do it?
0
votes
1answer
928 views

How to search recursively for a string in linux?

I want to search recursively for files containing a string. I want to search: Files in and under the directory I'm standing in currently A specific directory. I want to see only results. I don't ...
0
votes
2answers
296 views

Alias for recursive case insensitive search in current directory

How do I set an alias, such as "mysearch", which will search for a string recursively in the directory I'm standing in. It should be as below: mysearch "this table..." = find -type f -exec grep ...
0
votes
2answers
345 views

Search recursively for a string containing whitespaces

I want to search for "this table..." string under /home/myuser directory recursively, ie in all files under /home/myuser and in all directories and sub-directories under /home/myuser. /home/myuser ...
2
votes
3answers
1k views

Get LVM size using AWK?

I'm in need to find out the LVM size of image vm001. Let's say I have a LVM volume called /dev/VGgroup/vm001. Now using lvdisplay I can find out the size: --- Logical volume --- LV Name ...
0
votes
2answers
174 views

Linux: Show directory content as if it was a file?

I am a bit confused on what a directory really is. In various places I read that in Linux directories are just strings that keep the names of the nested files. In that case is there a way to show ...
4
votes
3answers
3k views

How to use grep to match domain names?

I have a list of urls like: hxxp://url.com/subpage.html hxxp://www.url2.com/index.php hxxp://subdomain.url3.com/somepage.php ... How can I use grep to match the domain names only? All the urls ...
3
votes
4answers
1k views

How to get the shortest string in a text file with shell

Assume I have a text file as below abcd aaaaaaa gfgk hahahahahahhahh gf Then gf would be returned.Any good ideas?