Search Results

Search: Posts Made By: rtagarra
6,630
Posted By pravin27
if [ ${x} -eq 12 ] && [ $(echo "$f" | grep -Ec...
if [ ${x} -eq 12 ] && [ $(echo "$f" | grep -Ec ".sql$") -eq 0 ];
6,630
Posted By RudiC
Drop the first square bracket and add one to the...
Drop the first square bracket and add one to the second test.
3,185
Posted By Yoda
For checking if pattern is not matching use...
For checking if pattern is not matching use logical not !
[[ ! "$F" =~ \.c$ ]] && # action
Or put action in else part:
[[ "$F" =~ \.c$ ]] && # matched action || # unmatched action
3,185
Posted By Yoda
These are Shell Parameter Expansion...
These are Shell Parameter Expansion (http://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html)

Below line is using regexp comparison operator =~ to check if line has...
3,185
Posted By Yoda
Here is another bash solution: #!/bin/bash ...
Here is another bash solution:
#!/bin/bash

while read line
do
[[ "$line" =~ "=" ]] && ptype="${line%% *}"

fname="${line#*=}"

for F in ${fname}
do
...
3,185
Posted By Scrutinizer
You could use a "#" to start the header lines and...
You could use a "#" to start the header lines and then test inside the loop:
[[ ${line[0]} == "#" ]] && continue
Or, you could set a boolean when the first = is encountered and test for that later...
3,185
Posted By Scrutinizer
Perhaps something like this is more what you are...
Perhaps something like this is more what you are looking for:
#!/bin/bash
while read -a line
do
if [[ ${line[1]} == "=" ]]; then
ptype=${line[0]}
unset line[0] line[1]
fi
for...
3,185
Posted By Scrutinizer
One way might be: awk '{$1=$1; sub($1 FS $2...
One way might be:
awk '{$1=$1; sub($1 FS $2 FS,x)}1' RS= file
But only if the empty lines are completely empty (contain no whitespace).
3,185
Posted By shamrock
Try this awk script... awk -F"[=]"...
Try this awk script...
awk -F"[=]" 'BEGIN{RS=""} {print $2}' test.dat

What exactly do you mean by the above statement...and for validation you would need to initialise an associative array with...
6,662
Posted By Yoda
If your definition of valid strings is only...
If your definition of valid strings is only alphabets, then try:
#!/bin/bash

while IFS="=" read v1 v2
do
[[ "$v1" =~ ^[[:alpha:]]+$ ]] && echo "String: \"$v1\" is valid" || echo...
3,706
Posted By vgersh99
Bumping up posts or double posting is not...
Bumping up posts or double posting is not permitted in these forums.

Please read the rules (https://www.unix.com/misc.php?do=cfrules), which you agreed to when you registered, if you have not...
2,030
Posted By Yoda
First operand is checking if string value:...
First operand is checking if string value: $driverName is equal to NULL ""

Second operand appears to be calling a function: checkFile by passing string value: $driverName as argument and checking...
Showing results 1 to 12 of 12

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