how to tokenize string in shell script
have a file likewist:
Code:
ip= |
Quote:
Do you mean something like this? Code:
#!/bin/bash Code:
chmod +x ./script.sh Code:
./script.sh |
giving you full description of my file:
Code:
default=0 like: title 3 : java ip=100.200.300.400 user=java pass=home & office thanx |
Code:
#!/bin/bash |
thnx catkin & nugat:
that was really a path making group steps. but if in case we try to put the same set of values written in file & put it back at the end. then inserting values for new entries. can you please suggest set of ways.. it kind of "NO SELF WRITING" on the file |
try something like this -
# Input file Code:
$ cat tokenize.txt Code:
#!/bin/bash Code:
$ ./tokenize.sh tokenize.txt Code:
$ more output_tokenize.txt |
Quote:
|
You've used the phrases 'i want to add values', 'create another title' & 'inserting values for new entries'. No where have you said where the script/program is supposed to get the new data. As this is somewhat central to the overall problem, it makes sense to describe how your data is to be acquired. It could come from many places, such as being read from a file, be embedded in the script/program, read from a commandline, read from standard input, read from a network connection of some sort, read from environment variables... The list is long. Sample data would be a very good thing.
--- rod. |
All times are GMT -5. The time now is 10:59 PM. |