Search Results

Search: Posts Made By: dixits
4,753
Posted By Don Cragun
I use ksh and bash; not csh. And, I strongly...
I use ksh and bash; not csh. And, I strongly prefer utilities that accept, but do not require, space between an option-letter and its option-argument. But, if I understand what you're trying to do,...
1,689
Posted By Corona688
In bourne shell: IFS="," ...
In bourne shell:

IFS=","
X="Session,Date,Type,Receive Coil Name,Manufacturer,Manufacturer's Model Name"

for VAR in $X
do
echo $VAR
done
1,733
Posted By Scott
This is very similar to your previous thread. Is...
This is very similar to your previous thread. Is there a theme developing, or shall we continue in dribs and drabs?


# X=1:2:3 ...
1,460
Posted By ahamed101
Will it be only numbers and _? Try this... echo...
Will it be only numbers and _? Try this...
echo $x | sed 's/.*ROI_\([0-9][0-9_]*\)_.*/\1/'

--ahamed
1,460
Posted By MadeInGermany
This one will return nothing if there is no match...
This one will return nothing if there is no match
sed -n 's/.*ROI_\(.*\)_AND_mod.*/\1/p'If the _mod is not a constant one must use a restriction on the matching part in brackets:
sed -n...
1,151
Posted By Scott
Use printf "%04d" with the value from the...
Use printf "%04d" with the value from the file.
1,151
Posted By shamrock
awk '{printf("%04d\n", $0)}' input.txt
awk '{printf("%04d\n", $0)}' input.txt
1,089
Posted By jim mcnamara
This is awk - shell does not matter that much. ...
This is awk - shell does not matter that much.


awk '{ for(i=1 ; i<=NF; i++) { $i*=$i }
print $0
}' somefile > anotherfile
1,089
Posted By Yoda
awk ' { for(i=1;i<=NF;i++) $i=($i*$i); print; } '...
awk ' { for(i=1;i<=NF;i++) $i=($i*$i); print; } ' infile
1,089
Posted By Corona688
Instead of $t += $t, $t *= $t.
Instead of $t += $t, $t *= $t.
969
Posted By in2nix4life
Greetings. Is your goal to just remove the...
Greetings.

Is your goal to just remove the quotes from around the letter A?

This would accomplish that by removing any non-alpha characters.


echo $x | sed 's/[^A-Za-z]//g'
969
Posted By Scrutinizer
Only quotes? sed "s/['\"]//g" or only around...
Only quotes?
sed "s/['\"]//g"
or only around the value?
sed "s/^['\"]*//; s/['\"]*$//"

bash/ksh93:
echo "${x//[\"\']}"
969
Posted By ctsgnb
Or more funny : echo $x | sed...
Or more funny :
echo $x | sed 's/""*/"/g;s/.*"\(.*\)".*/\1/'

# echo '"""""""""""""""A"""' | sed 's/""*/"/g;s/.*"\(.*\)".*/\1/'
A
Showing results 1 to 13 of 13

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