[Novalug] substrings FQDN names in bash scripting

Mike Shade mshade@mshade.org
Tue Mar 3 14:52:31 EST 2009


Miguel --

Perhaps awk, using '.' as the field separator.

awk -F. '{ print $1}' yourfile.txt

-- Mike

On Tue, Mar 3, 2009 at 2:41 PM, Miguel Gonzalez
<miguel_3_gonzalez@yahoo.es>wrote:

>
> Dear all,
>
>  It's driving me nuts...
>
>  I'm trying to short a list of servers which comprises short and FQDN
> server so all of them are converted to hostnames so if i have:
>
>  server1.domain.com
>  server2
>  server3.domain.com
>
>  I convert them all into:
>
>  server1
>  server2
>  server3
>
>  I have a $i variable that iterates the list of servers.
>
>  I was trying something like:
>
>  echo ${"$i":echo `expr match "Si" '.*'`}
>
>  but it doesn't work.
>
>  Any help? I've googled but no luck
>
>  Miguel
>
>
>
>
>
>
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20090303/692199a6/attachment.htm>


More information about the Novalug mailing list