On Thu, Nov 29, 2012 at 6:48 PM, inode0 <ino...@gmail.com> wrote:
> On Thu, Nov 29, 2012 at 5:33 PM, John Horne <john.ho...@plymouth.ac.uk> wrote:
>> Hello,
>>
>> I have a bash script in which a variable is set to one or more lines of
>> text. What I want is to remove any lines up to and including a blank
>> line (or alternatively to echo all the lines after the last blank line).
>> There may be zero or more blank lines, and the blank lines need not be
>> consecutive. If there is no blank line, then all the lines should be
>> shown. If the last line is blank, then nothing should be shown. So for
>> example the variable may contain:
>>
>> ============ (the '=' are not part of the variable)
>> abc def
>>
>> hijk
>> xyz
>> ============
>>
>> So in this case what is wanted is:
>>
>> ============
>> hijk
>> xyz
>> ============
>>
>> to be shown.
>>
>> I tried something like:
>>
>>    echo "$XX" | sed -e '/./,/^$/d'
>>
>> but this didn't display anything. (Where XX is the variable.)
>
> echo "${XX[*]/*
>
> }"

Oh, for a simple variable this should work

echo "${XX/*

}"

John
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to