Re: Bash - an odd problem using sed or awk or for

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 30, 2012 at 5:32 AM, John Horne <john.horne@xxxxxxxxxxxxxx> wrote:
> On Thu, 2012-11-29 at 18:56 -0600, inode0 wrote:
>
>>
>> Oh, for a simple variable this should work
>>
>> echo "${XX/*
>>
>> }"
>>
> Hello,
>
> Yes, that does seem to work :-)
>
> Although I have to admit I'm not sure why! I'll investigate further :-)

Basically it just drops the longest substring that matches the given
pattern (match anything followed by two newlines). This does
potentially miss some edge cases if you can have strings containing
only a single leading or possibly trailing blank line. But you can
remove leading and trailing blank lines if necessary or come up with
something more clever. See the "Parameter Expansion" section of the
bash man page for the details of this and other frequently useful ways
to expand/modify variables.

John
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
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


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux