Search Results

Search: Posts Made By: Irishboy24
3,012
Posted By Aia
#!/bin/bash export PATH=$PATH:/home/Dir ...
#!/bin/bash
export PATH=$PATH:/home/Dir
export AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY
export AWS_CREDENTIAL_FILE

/usr/local/bin/ec2-stop-instances i-xxxx --region us-west-2...
1,727
Posted By blackrageous
copy the contents into the main script file...you...
copy the contents into the main script file...you can read it right?
1,727
Posted By vgersh99
couple of questions: is 'another_script'...
couple of questions:


is 'another_script' residing in the same dir as the 'remote_script.sh'? If not, can its location be determined relative of the location of the 'remote_script.sh'?
Do you...
1,727
Posted By blackrageous
You show that you are logging in as the root...
You show that you are logging in as the root user. Who owns the file?
Why not just read the contents of that second script file and merge it into the one script. You're sourcing that script to save...
1,727
Posted By blackrageous
Use a full path to the another_script.sh, inside...
Use a full path to the another_script.sh, inside the remote_script.
3,835
Posted By Corona688
how about awk? Use nawk on solaris. awk...
how about awk? Use nawk on solaris. awk '/pattern/ {
for(N=1; N<=3; N++)
{
if(N>1) getline
print "#", $0;
}
next } 1' inputfile...
3,835
Posted By alister
The sed command didn't work for you because the...
The sed command didn't work for you because the relative address +2 is a non-standard GNU sed extension. However, the standard ed text editor supports this type of addressing. And since ed can write...
3,835
Posted By Scrutinizer
Some more golf ;) awk '/pattern/{c=3}...
Some more golf ;)
awk '/pattern/{c=3} c-->0{printf "#"}1' infile

sed version:
sed '/pattern/{N; N; s/^/#/; s/\n/&#/g;}' infile
3,835
Posted By Corona688
write to a new file, then overwrite the old. ...
write to a new file, then overwrite the old. That's all -i does anyway.

Of course, it's always dangerous to overwrite your originals. Ideally you could just use the originals as templates for...
3,835
Posted By balajesuri
[user@home-pc ~]$ cat file ... ... ... ...
[user@home-pc ~]$ cat file
...
...
...
Hello world
how r u
whats up
....
....
...
[user@home-pc ~]$ perl -i.bak -lne 'if(/Hello/){$f=1;$l=$.;print "# $_";}elsif($f==1 && $.<=$l+2){print "#...
3,835
Posted By Chubler_XL
Try: sed '/Hello world/,+2s/^/#/' list.txt...
Try:

sed '/Hello world/,+2s/^/#/' list.txt > list_$$.txt
mv list_$$.txt list.txt
6,291
Posted By Don Cragun
In at, now means at this time today. Specifying...
In at, now means at this time today. Specifying now and tomorrow gives conflicting specifications for when the job should be run. If you want to run a job every day at about noon, you can start it...
2,364
Posted By mirni
If you are using GNU awk, you can do all with one...
If you are using GNU awk, you can do all with one awk sweep.
awk -F'[<>]' '{print $3}' xmlfileNote that this assumes there is at most one value per line.
awk -F'[<>]' '{print $3,$7,$11}'...
5,736
Posted By Tribe
So you want to force the create flag? You...
So you want to force the create flag?

You can run the exec command at the end of the find search, and redirect all found arguments at once:

find ./ -type f -name "*.txt" -exec tar -cvf...
5,736
Posted By Tribe
You should use update. Actually you are creating...
You should use update. Actually you are creating a new tar archive each time overwriting the already existent (if) so only the last found txt will be in tar archive. So it would look like:

find ./...
1,067
Posted By alister
sed's substitute command's format:...
sed's substitute command's format: s/re/repl/flags
Note the absence of a trailing forward-slash delimiter. You want to use a flag value of 2, not \2/.

Although it probably has nothing to do with...
985
Posted By vlm
no it doesn't have to be sed.The only thing is...
no it doesn't have to be sed.The only thing is that is a bash script.
Is this a problem for using perl?
1,027
Posted By elixir_sinari
awk -F: 'tolower($1) ~...
awk -F: 'tolower($1) ~ /testaccount2/{for(i=1;i<=NF;i++){if($i ~ /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/) print $i}}' inputfile
10
3,391
Posted By spynappels
How about a variation of the following? ...
How about a variation of the following?

var=$(date --date=20120305 +%s)

var=$(($var-86400))

date -d @$var +%Y%m%d

Substitute the first date with a variable from elsewhere in the script...
16,636
Posted By Scrutinizer
When using shell "time" the backticks are not...
When using shell "time" the backticks are not required as "time" is part of the shell syntax. Also, it is good to direct the output to /dev/null, while testing and the system cache needs to be taken...
16,636
Posted By zer0sig
you could always try a comparison script to see...
you could always try a comparison script to see how these are performing on your machine - e.g.

#!/bin/sh
time `sed -n '25000,26000 p' filename`
time `awk 'NR==25000,NR==26000' filename`
exit 0...
16,636
Posted By Corona688
It depends on your implementations of sed and...
It depends on your implementations of sed and awk, so isn't a certain thing. It can vary quite a lot, and our results may not be relevant to your system.

I'd be curious whether this is faster...
2,054
Posted By elixir_sinari
awk '/select/ {print match($0,/select/)}' file
awk '/select/ {print match($0,/select/)}' file
2,054
Posted By jim mcnamara
awk 'NR==1 {print index($0,"select"); exit}'...
awk 'NR==1 {print index($0,"select"); exit}' inputfile
1,580
Posted By alister
It is splitting on a - character and using NF...
It is splitting on a - character and using NF (the number of fields in the record) to distinguish between formats (the one's that don't have a - will have only one field, those with a - will have...
Showing results 1 to 25 of 29

 
All times are GMT -4. The time now is 09:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy