![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script required to get a required info from file. Pls. help me. | ntgobinath | Shell Programming and Scripting | 2 | 05-31-2008 05:34 AM |
| Script Required | Satadru | Shell Programming and Scripting | 1 | 05-08-2008 09:38 AM |
| Script required | ntgobinath | Shell Programming and Scripting | 1 | 05-08-2008 08:35 AM |
| script required | skyineyes | Shell Programming and Scripting | 13 | 06-26-2007 10:49 PM |
| Script help required! | kev112 | Shell Programming and Scripting | 8 | 05-24-2005 01:33 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
help required in writing the script
Hi All,
Please help me in writting the script File contains: ========= 11424444, <basicpage> jfalfksf <dateofbirth>10/02/2005</dateofbrith> jkaklgja lg'd .... 11423224444, <basicpage> jfalfksf <dateofbirth>11/02/2005</dateofbrith> jkaklgja lg'd 11433523224444, <basicpage> jfalfksf <dateofbirth>09/03/2005</dateofbrith> jkaklgja lg'd <dateofbirth>09/03/2005</dateofbrith> ......... ..... output in 1.txt ====== 11424444, <basicpage> <dateofbirth>10/02/2005</dateofbrith> output in 2.txt ========== 11433523224444, <basicpage> <dateofbirth>09/03/2005</dateofbrith> <dateofbirth>09/03/2005</dateofbrith> Here if the dateofbrith occurence is once before the next basicpage then the output should go 1.txt file else if the dateofbrith string comes again before the next basicpage string then it should send the output to the other file say 2.txt Thanks satish |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Have a look at the rules.
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly. Here is your original post - Help required |
|
#3
|
|||
|
|||
|
Thank you. I have deleted the second one.
|
|
#4
|
||||
|
||||
|
And a third one at help required in unix command/script
|
|
#5
|
||||
|
||||
|
Third duplicate thread closed.
thaduka, Please stop wasting our time by posting the same question several times. This is a question on shell scripting, so belongs in this forum. If you would like a prompt reply, it may help if you could post what you have done already. You don't say which shell you are using. This should work for bash or ksh... Code:
while read l
do
case $l in
*basicpage*) ((c=c+1)) ; f=myfile$c.txt ; [[ -s $f ]] && rm $f ;;
esac
case $l in
*basicpage*|*dateofbrith*) echo "$l" >> $f ;;
esac
done < infile
|
||||
| Google The UNIX and Linux Forums |