Re: How to do an array?
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Sun, 8 Apr 2007 16:55:08 -0400
On 2007-04-08, Dave Kelly wrote:
I am going to ask this here. Part belongs in this users group and
part in another. I have a html file that consists of several hundred
lines such as the group below. To store the data on the server, am I
correct to say an array is created and for this example the array
has a name of 'describe[]'?
<div style="text-align: center;"><h2>Personal Data</h2></div>
<p>Your Name: <input type=text name=describe[] size="40%"
maxlength=256>
Tel: <input type=text name=describe[] size="30%" maxlength=16>
Date of Report: <input type=text name=describe[] size="10%"
maxlength=16></p>
<p>Your Address: <input type=text name=describe[] size="60%"
maxlength=1024>
E-Mail: <input type=text name=describe[] size="30%"
maxlength=1024></p>
</body>
I need to fill the [] with a number. I had wanted to write a shell script
to do that. I have googled for 2 days and have yet to discover how
to increment a numerical variable in 'sed'.
Use awk, not sed, e.g.:
awk 'BEGIN { n = 1 }
{ while ( sub(/[[][]]/,"[" n "]" ) ) ++n ; print }
' FILENAME > NEWFILE
Can someone help me or more importantly, tell me where the tutorial is
that will
answer these question.
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
========= Do not reply to the From: address; use Reply-To: ========
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
.
- Follow-Ups:
- Re: How to do an array?
- From: Dave Kelly
- Re: How to do an array?
- References:
- How to do an array?
- From: Dave Kelly
- How to do an array?
- Prev by Date: Re: Which audio / video formats?
- Next by Date: Re: content-type and unicode
- Previous by thread: Re: How to do an array?
- Next by thread: Re: How to do an array?
- Index(es):
Relevant Pages
|