![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| urgent help needed!!in copying files to /tmp at boot time,pls help! | wrapster | UNIX for Advanced & Expert Users | 0 | 04-27-2008 11:00 AM |
| urgent-extracting block data from flat file using shell script | shirish_cd | Shell Programming and Scripting | 4 | 02-06-2008 09:05 AM |
| script needed urgent | jayaramanit | Shell Programming and Scripting | 2 | 09-11-2007 09:35 AM |
| Urgent Script Needed | skyineyes | UNIX for Dummies Questions & Answers | 1 | 06-20-2007 05:36 AM |
| Urgent answer needed, please: help with a text editor | MtFR | UNIX for Dummies Questions & Answers | 4 | 05-22-2004 01:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
URGENT: Script/Function needed to read text property files in block wise
Hi,
Iam in a need for a script/function in KSH where I want to read a text file (property file) in block by block. Here is the example: Heading Name Descripton Block Block1 Value1 Description Property Name Value Property Name Value Property Name Value Property Name Value Property Name Value Property Name Value Property Name Value Block Block2 Value2 Description Property Name Value Property Name Value Property Name Value Property Name Value Property Name Value Property Name Value Property Name Value As per the above example, my requirement is similar to this. I want to read entire bock including its name, values and process them, along with them I want to read their Property Names/Values and create under that Block. The main requirement is, no other block's Property's should be mingled/interfered with other Block's Properties. Any help is greatly appreciated. |
|
||||
|
Is there any separator between 2 blocks? Or do you have something special to identify the beginning of a block? If I knew it began by "Block", say, I would write in sh something like
function block () { local l local b=0 read line while [ "$line" ]; do case "$line" in Block*) b=$((b+1)) echo "beginning of block $b" l=1 ;; *) echo "line $l of block $b" l=$((l+1)) esac read line done } Should work in ksh too. |
|
||||
|
URGENT: Script/Function needed to read text property files in block wise
Hi,
Thanks for the reply. But in your script function, where do we refer to the text file from where we are reading the input. Can you explain in little bit more please. |
|
||||
|
The function reads from stdin. Assuming you saved my code in a /tmp/script file, and that you wish to read a file nammed foo.txt you need to source /tmp/script, and then pipe foo.txt to the function. Namely:
source /tmp/script block < foo.txt or: cat foo.txt | block BTW, my function is not ksh compatible, but bash compatible. But could properly read a file like this: Block b1 hello line1 world line2 Block b2 hi line3 again line4 end line5 |
|
||||
|
Read properties file value
Hi, I have fileds like
uname="test" pwd="ujeua" in host.properties file. I want to read these values in a sh file. for i in `ls ${directory}/chk.properties do ------how to get values here-------------- done Thanks |
|
||||
|
Reading property files from a script
Even I had a similar requirement.
Have got a way to read the properties with below command . cfg/props.properties but am getting the below error for every blank line : command not found: line 8: : command not found: line 10: : command not found: line 12: Can any one help me removing the blank spaces before reading the properties file? Or is there any better way to read property files? Thanks in advance, Surendra |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|