From: John Aspinall <jgaspinall@rcn.com>
To: dave@dpomeroy.com
Cc: linux-newbie@vger.kernel.org
Subject: Re: parsing a string
Date: Mon, 09 Aug 2004 22:12:26 -0400 [thread overview]
Message-ID: <41182F0A.9070807@rcn.com> (raw)
In-Reply-To: <1092096481.411811e1bc136@webmail.dpomeroy.com>
dave@dpomeroy.com wrote:
> I'm new to bash and am trying to write a script that puts 3 substrings in 3
> variables. I have a string with password,firstname,lastname. and I need it to
> be in 3 variables.
I'm just an apprentice here, but I think "cut" is a good choice of tool.
$ echo 'password,firstname,lastname' | cut -d',' -f1
password
$ echo 'password,firstname,lastname' | cut -d',' -f2
firstname
$ echo 'password,firstname,lastname' | cut -d',' -f3
lastname
-d is the field delimiter, -f says which fields you want
John
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2004-08-10 2:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-10 0:08 parsing a string dave
2004-08-10 2:12 ` John Aspinall [this message]
2004-08-10 8:48 ` Jeff Woods
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41182F0A.9070807@rcn.com \
--to=jgaspinall@rcn.com \
--cc=dave@dpomeroy.com \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.