AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
Colm Connolly
February 10, 2009 04:39AM
Tynan Stevens wrote:

> David, could you explain to me the syntax of the second step of
> your bash code for extracting the degrees of freedom?
>
> I am interested in doing something similar to parse the maximum
> value of a dataset out of 3dinfo. I think I made it work by
> using something like:
>
> maximum=${maximum##*to}
>

From the bash man page:

${parameter#word}
${parameter##word}
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches the beginning of the value of parameter, then the result of the
expansion is the expanded value of parameter with the shortest matching pattern (the ``#'' case) or the longest matching pattern (the ``##'' case) deleted. If
parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an
array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.

${parameter%word}
${parameter%%word}
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches a trailing portion of the expanded value of parameter, then the
result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``%'' case) or the longest matching pattern (the ``%%'' case)
deleted. If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If param-
eter is an array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant
list.


For example,

maximum="footoblahbar"
then ${maximum##*to} will give you blahbar, that is foo is matched by * and to by to, the net effect is that footo is gobbled up by the variable expansion.

They are similar to, though considerably more powerful than, the the :r and :h variable modifiers in [t]csh.

Subject Author Posted

thresholding on p-value in 3dmerge?

David Perlman January 29, 2009 08:18PM

Re: thresholding on p-value in 3dmerge?

David Perlman January 29, 2009 08:32PM

Re: thresholding on p-value in 3dmerge?

Bob Cox January 30, 2009 01:16PM

Re: thresholding on p-value in 3dmerge?

David Perlman February 01, 2009 02:35PM

Re: thresholding on p-value in 3dmerge?

bob cox February 01, 2009 03:57PM

Re: thresholding on p-value in 3dmerge?

David Perlman February 01, 2009 07:22PM

Re: thresholding on p-value in 3dmerge?

Tynan Stevens February 09, 2009 08:21PM

Re: thresholding on p-value in 3dmerge?

Colm Connolly February 10, 2009 04:39AM

Re: thresholding on p-value in 3dmerge?

Tynan Stevens February 10, 2009 08:58AM

Re: thresholding on p-value in 3dmerge?

Bob Cox February 02, 2009 10:23AM