Search Results

Search: Posts Made By: vlm
993
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,152
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) {...}"
957
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,412
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,289
Posted By fpmurphy
sed 's/.*\[\([a-zA-Z0-9_]*\).*/\1/'
sed 's/.*\[\([a-zA-Z0-9_]*\).*/\1/'
Forum: Programming 06-05-2012
3,416
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,416
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,035
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,035
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,146
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,146
Posted By Scrutinizer
while IFS=\" read user id town do echo...
while IFS=\" read user id town
do
echo "$id"
done < file
3,146
Posted By elixir_sinari
echo 'Jennifer Jones (student)...
echo 'Jennifer Jones (student) "id:376765748587/7465674775" NewYork'|sed 's/.*"\([^"]*\)".*/\1/g'
3,146
Posted By itkamaraj
echo 'Jennifer Jones (student)...
echo 'Jennifer Jones (student) "id:376765748587/7465674775" NewYork' | awk -F\" '{print $2}'
3,146
Posted By donadarsh
echo "Jennifer Jones (student)...
echo "Jennifer Jones (student) \"id:376765748587/7465674775\" NewYork"|cut -d"\"" -f2
1,442
Posted By itkamaraj
awk '/www/' filename
awk '/www/' filename
1,442
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,442
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,442
Posted By donadarsh
try to put variable in double quotes - ...
try to put variable in double quotes -

stringtocheck=("$line")
echo "$stringtocheck"
844
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,834
Posted By Corona688
mkdir /absolute/path/to/folder
mkdir /absolute/path/to/folder
1,350
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:]]* ]]
3,997
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,350
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,350
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,701
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 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy