Oops, please disregard my previous post. I spaced out -- using quotes in the for loop would treat the whole output of find as one thing: the loop would run only once, and it would contain everything. Sorry for misinformation...
Yes, certainly, forward slash is perfectly valid character in variables.
But not if you are doing something like:
and $word or $other contain slashes, sed will be confused. In that case, you can use some other character as delimiter for 's' command, like:
or
To exlude the extensions, do:
or
-o stands for OR, -a for AND, parens have to escaped, otherwise shell interprets them as "run in subshell"
Hi,
I am having issues with the jar -tf command when I put in the shell script.
The command runs fine from the command line as shown below.
# jar -tf "./VirtualBox Dropped Files/2016-04-17T20:58:49.129139000Z/hive-exec-0.8.1.jar"
But when I put in a shell script(shown below) and the... (10 Replies)
This script writes the output files to FILES but I don't want to exclude all directories from ABC_CHQ and LYS_ADV, I want to include one sub directory name process which is under ABC_CHQ and LYS_ADV in the search. Right now its excluding everything from prune directories such as ABC_CHQ, LYS_ADV... (10 Replies)
I've got a sed shell script I've been using for quite a while to do batch find/replace operations on .xml files containing various types of text entries. This is the script I use:
#!/bin/bash
while read text_old text_new; do
sed_script+="s/$text_old/$text_new/g;"
done < trans_old_to_new... (9 Replies)
I need to find empty files in a directory and write them into a text file. Directory will contain old files as well, i need to get the empty files for the last one hour only. (1 Reply)
I would need a command for finding first 15000 of the file names whose 25th postion is 5 in the current directory alone.
I do have this painful command
find . -name '5*' | head -15000 | cut -c3-
please refine this.
Of course the above command also searches in the sub directories... (3 Replies)
I have a script that generates a variable with the location of a file and its complete path. What i want to do is to "cd" to the directory where that file is located using the path name of the file. GIS has absolutely failed me.
For example when i run my script it generates a variable called... (1 Reply)
Hi,
how can find length of file names in a directory.
Examp:
I have a directory with name "d1".
directory: d1
files:
aaa.log
bbb.log
abcd.log
abcdef.log
I wold like out put like:
file name legnth
aaa.log 3
bbb.log 3
abcd.log 4
abcdef.log 5 (5 Replies)
ive looked and couldnt find an answer...
can someone tell me how i can replace spaces and characters with an "_" on multiple folders?
thanx muchly. (1 Reply)
The script below was written to select files and convert a particular string to something other and replace that file. However, I came across some issues with filenames that contain spaces, any suggestions to get around this? Any other suggestions that may apply to this code would also be... (5 Replies)