I wrote:
> How does
> nano +100 /etc/services
> look to you? (^X means ctrl-X)
pressed “Send”, and realised you wanted to open at a regexp, not a fixed
line.
That sounds like a job for shell scripting.
If the file isn’t massive, try something like:
nano +$(grep -n "message submission" /etc/services|head -n1| cut -d: -f1)
/etc/services
That’s
grep -n pattern $FILENAME
to find the pattern, prefixed with the line number. Pipe it through
head -n1
to get the first line with it on, and then through
cut -d: -f1
to get everything before the colon (which will be the line number you
want). Put all of that in `` or in $( ) , which will mean the shell will
interpret the contents of `` or $( ) and put the result (in this case
the line number) there instead.
That should work for any editor which understands the +line-no notation,
which I think is most of them.
Hope this helps,
James.
--
E-mail: james@ | “The letters are Elvish, of an ancient mode, but the
aprilcottage.co.uk | language is that of Microsoft, which I will not utter
| here. But this in the Common Tongue is what is said: By
| this or any other name, You are well and truly...”
--
fedora-list mailing list
[email protected]
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines