i have to search for a particular text in files and for that im using grep command but it searches only in current folder.What i want is that using a single grep command i can search a particular thing in the current folder as well as in all of its sub folders.How can i do that???
...
Hi ,
i am writing one shell script to download and display the content from a site and i am saving this content in my local file system.
i have used the following wget in the script to get the content :
/usr/sfw/bin/wget -q -p -nH -np --referer=$INFO_REF --timeout=300 -P $TMPDIR $INFO_URL
where INFO_REF is the page where i need to di...
Hi I am using wget to copy a data from url and store it in a file.The url gives me a aspx file .I need to convert the aspx file to html file.SO I renamed the file from asd.aspx to asd.html.But in my file there are relative url which are not working in my html file.They should point to original url.How can i convert the relative url to t...
How to pass values from child shell to parent shell in shell programming?
...
I can see in unix shell scripts that following construction used
[ x"$VAR" = x"VALUE" ]
instead of
[ "$VAR" = "VALUE" ]
Why?
...
First of all, I'm a beginner on shell-script. This code I've done is not working.
I want to repeat a code for 30 seconds but it doesn't work. It just keep doing my logic indefinitely.
DIFF=0
while [ $DIFF < 30 ]; do
START=$(date +%s)
######## My logic #########
DIFF=$(( $END - $START ))
echo $DIFF
cd ..
sleep 5...
I have the following code:
get_list_a()
{
$MYSQL -B -u $USER --passwword="$PW" $DB1 <<EOF
select name, value from mytable_a
EOF
}
get_list_b()
{
$MYSQL -B -u $USER --passwword="$PW" $DB2 <<EOF
select name, value from mytable_b
EOF
}
get_list_a >$test.txt
Now I need to combine a and b first and remove all dups(key is name, ...
How do I implement fork and exec in bash?
Let us suppose script as
echo "Script starts"
function_to_fork(){
sleep 5
echo "Hello"
}
echo "Script ends"
Basically I want that function to be called as new process like in C we use fork and exec calls..
From the script it is expected that the parent script will end and then after 5 seco...
I'm having trouble preserving whitespace in a bash script:
CURRENT_YEAR=$(date "+%Y")
MESSAGE=$(eval echo "$(/usr/libexec/PlistBuddy -c "Print NSHumanReadableCopyright" Info.plist)")
/usr/libexec/PlistBuddy -c "Set NSHumanReadableCopyright $MESSAGE" ${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}
The relevant section Info.plist:
<NSHum...
I have a shell script that outputs filenames (one per line). I want to put that output into a list in AppleScript.
How can I do this?
Bonus points for how to then turn those filename strings into file objects.
EDIT:
When trying this:
set theFiles to {}
repeat with i from 1 to count of filenames
set end of theFiles to (POSIX file...
Hello all, I have written a custom shell script function, and put in in my .profile.
When I run the command that executes the function from my terminal, it works just fine, however when I run the command from MacVim, it does nothing. The function in my .profile is not being run when I run the command from Macvim.
How to I get this to...
I have created one shell script in my lib folder.
And i want to use RAILS_ROOT in that script instead of the long path.
Is there any way i can do this?
This my script
if ! [ -s delayed_job.pids ]; then
RAILS_ENV=production /home/app/script/delayed_job start
fi
I want to modified this line with something like that.
if ! [ -s d...
I have a file that has two columns of floating point values. I also have a C program that takes a floating point value as input and returns another floating point value as output.
What I'd like to do is the following: for each row in the original, execute the C program with the value in the first column as input, and then print out the...
How can I find the longest line in a .txt file and then fill all other lines at their end to that length with blank spaces?
My guess is this is easy to answer. I know very little about using the awk, paste command
and such. Maybe someone can help me out. Thanks!
A little more specific... so far I can do the following. This would get th...
I have input that looks like
5 X
8 Y
3 Z
9 X
I want output that sums the numerical values for each 'tag'; e.g.
14 X
8 Y
3 Z
Wondering if there is a slick one liner I can use (along the lines of the ones for summing a list of integers using awk).
...
Hello everyone,
I'm trying to make a filter on script to make this happen:
Before:
123.125.66.126 - - [05/Apr/2010:09:18:12 -0300] "GET / HTTP/1.1" 302 290
66.249.71.167 - - [05/Apr/2010:09:18:13 -0300] "GET /robots.txt HTTP/1.1" 404 290
66.249.71.167 - - [05/Apr/2010:09:18:13 -0300] "GET /~leonardo_campos/IFBA/Web_Design_Aula_17.pdf ...
What I need to do is extract the filename from %%f so I can create the correct dll name.
for %%f in (*.asmx.cs) do (
echo %%f
cmd /c C:\windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /t:library /r:%assemblies% %compileoptions% /out:bin/%%f.dll %%f
)
...
Hello every one... Anyone know how can I calculate the mean of one these columns (on linux)??
sda 2.91 20.44 6.13 2.95 217.53 186.67 44.55 0.84 92.97
sda 0.00 0.00 2.00 0.00 80.00 0.00 40.00 0.22 110.00
sda 0.00 0.00 2.00 0.00 144.00 ...
I've got some issues on scripting... if someone could help me, it would be really good !
My script has:
VISITS=$((WR + RD));
SERVICE_DEMAND=$((VISITS*SERVICE_DEMAND));
And I'm getting this error:
./calc_serv_demand.sh: line 12:
0.0895406: syntax error: invalid arithmetic operator (error token is
".0895406")
Can someone hel...
I have the following perl script that works locally given the input parameters.
I need the script to access remote servers for the same information, given that I've already setup the ssh keys successfully. The path for the logfiles on the remote servers are identical to local. Configuration for remote servers are identical. I just need t...