Search Results

Search: Posts Made By: vlm
995
Posted By bartus11
Perl will work just fine in a bash script.
Perl will work just fine in a bash script.
Forum: Programming 06-13-2012
4,201
Posted By shamrock
Dont know what code is inside fun but you cant...
Dont know what code is inside fun but you cant dereference a void*...besides a[i] is a void* not void** so definition of fun needs to change to "void fun(void *b) {...}"
962
Posted By frank_rizzo
add the -i option for case insensitive. or change...
add the -i option for case insensitive. or change the pattern [Hh].
11,432
Posted By agama
Comm can output lines that are common to both...
Comm can output lines that are common to both files, but from your initial post you suggest that you only have one file to work with and comm won't help with that.

Given that your file is already...
1,292
Posted By fpmurphy
sed 's/.*\[\([a-zA-Z0-9_]*\).*/\1/'
sed 's/.*\[\([a-zA-Z0-9_]*\).*/\1/'
Forum: Programming 06-05-2012
3,435
Posted By Corona688
wait() waits for children to die. If they're not...
wait() waits for children to die. If they're not supposed to die, don't wait() at all.
Forum: Programming 06-04-2012
3,435
Posted By Corona688
The most obvious way would be a pipe... The...
The most obvious way would be a pipe... The child reads from the read end of the pipe, but when there's nothing to be read, that will cause it to wait. The parent writes when it wants to wake the...
Forum: Programming 06-04-2012
2,040
Posted By Corona688
As an aside, that's not a particularly good...
As an aside, that's not a particularly good method for hashing an integer. It means integers n, n+1, n+2, etc will all end up in a row in the table, which will make searching for empty slots slow if...
Forum: Programming 06-04-2012
2,040
Posted By shamrock
It depends on how you want to use the int output...
It depends on how you want to use the int output of the hash function...is it to be used as an index into the array...in which case you can add up the ascii values of each of the individual...
3,160
Posted By elixir_sinari
echo 'Brad Robins "worker in FGD" LA...
echo 'Brad Robins "worker in FGD" LA "id:3476543774/638957685" alternative::"id:7567756/38584896"'|awk -F\" '{for(i=1;i<=NF;i++) if($i ~ /^id:/) print $i}'
3,160
Posted By Scrutinizer
while IFS=\" read user id town do echo...
while IFS=\" read user id town
do
echo "$id"
done < file
3,160
Posted By elixir_sinari
echo 'Jennifer Jones (student)...
echo 'Jennifer Jones (student) "id:376765748587/7465674775" NewYork'|sed 's/.*"\([^"]*\)".*/\1/g'
3,160
Posted By itkamaraj
echo 'Jennifer Jones (student)...
echo 'Jennifer Jones (student) "id:376765748587/7465674775" NewYork' | awk -F\" '{print $2}'
3,160
Posted By donadarsh
echo "Jennifer Jones (student)...
echo "Jennifer Jones (student) \"id:376765748587/7465674775\" NewYork"|cut -d"\"" -f2
1,459
Posted By itkamaraj
awk '/www/' filename
awk '/www/' filename
1,459
Posted By Scrutinizer
@OP: Why the parentheses? stringtocheck=$line ...
@OP: Why the parentheses?
stringtocheck=$line
The intermediate variable is not necessary:
while read line;
do
if [[ "$line" == *www.* ]]; then
#do things
fi
done < ./tempfile


or,...
1,459
Posted By Klashxx
Try: while read line do if [ $(echo...
Try:
while read line
do
if [ $(echo "${line}"|grep -c "www\..*") -ne 0 ]
then
//do things
fi

done < './tempfile'
1,459
Posted By donadarsh
try to put variable in double quotes - ...
try to put variable in double quotes -

stringtocheck=("$line")
echo "$stringtocheck"
847
Posted By Corona688
Is the filename really relevant here? The URL...
Is the filename really relevant here? The URL didn't contain one, so wget saved a default name. For URL's with no filename, you could've told it -O index.html and then you'd know. For URL's with a...
3,853
Posted By Corona688
mkdir /absolute/path/to/folder
mkdir /absolute/path/to/folder
1,352
Posted By neutronscott
it can also be left out the left hand side in...
it can also be left out the left hand side in bash's [[ :cool:


[[ $day = [[:alpha:]]* ]]
4,012
Posted By agama
Yes, but exactly how depends on a few things. Is...
Yes, but exactly how depends on a few things. Is this string a part of a record contained in a file, and thus you want to replace all of these strings with just the last two chracters? Or, is this...
1,352
Posted By Scrutinizer
I would also have a preference for case since it...
I would also have a preference for case since it is more portable. Since you are using bash you could also use:
if [[ "$day" == [A-Za-z]* ]]; then

--
@jlliagre: in light of our other interesting...
1,352
Posted By jlliagre
I would use case instead of if: case "$day" in ...
I would use case instead of if:
case "$day" in
([A-Za-z]*) echo ok ;;
(*) echo ko ;;
esac
2,744
Posted By Corona688
awk '{ A[$1 " " $2] += $3 } END { for(X in A)...
awk '{ A[$1 " " $2] += $3 } END { for(X in A) print X, A[X] }' filename
Showing results 1 to 25 of 25

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