doubt to treat plaintext script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers doubt to treat plaintext script
# 1  
Old 12-03-2010
doubt to treat plaintext script

Hi everyone!

first of all thank you all for the forum.

My question is, is there a bash or java program, which addresses the existing text in the html that is visible in the web page for editing by another string, eg

name1: flakjsdlñfjas
Name of father: fdfjaksdfjskdfsd



Well it would take that file, for example index1.html and modify the fields "Name1" and "father's name" and change this string for another or adding such a xx's the end. So that is "nombre1xx" and "name of padrexx"

there is something?

Let me explain

I'm trying to do is a bash script
Take for example a line
<td colspan="2"> class="primera" <p class="titu"> Mama One </ p> </ td>

detected Mama One and replace it with xxMama Unoxx or **Mama One**

say that if file called index.html then take and take an output file or mod_index.html eg index1.html

I'm currently editing is some code in c to try to catch those fields and change or add to a string.

Greetings to all and thanks to all


I did this... 1/2
Code:
if [ $# != 2 ]; then
    echo "Necesitas pasar dos argumentos."
    exit 1
fi

while read p; do
    
    for i in $p
    do

        echo $i
        (echo ${#i}) > var
        
        (echo 2) > resta
        
        let var1=var-2
        
        if [ "${i[0]:(echo $var1) }" == '">' ]; then
            #echo ${#$i}
                
            echo "*********************Lo ultimo recibido ha sido un >";

            echo ${i[0]:0:1}
            echo 1 > anterior

        fi

        if [ "${i[0]:0:1}" != '<' ]; then
            echo ${i[0]:0:1}
            echo "*********************no es <"
            if [ "echo $anterior" != "1" ]; then
                echo 0 > anterior
                echo "*********************  $i"
            fi
            if [ "echo $anterior" == "0" ]; then
                echo "*********************  $i"
            fi
        fi

        if [ "${i[0]:0:1}" == '<' ]; then
            echo ${i[0]:0:1}
            echo "*********************ES <"
            echo 0 > anterior
        fi

        

        
        echo $anterior
    done
    
done < $1


Last edited by vbe; 12-03-2010 at 10:04 AM.. Reason: code tags please
# 2  
Old 12-04-2010
Code:
sed 's|> \([^=<]*\) <|> '"$var"'\1'"$var"' <|' input

Code:
$ echo '<td colspan="2"> class="primera" <p class="titu"> Mama One </ p> </ td>'
<td colspan="2"> class="primera" <p class="titu"> Mama One </ p> </ td>
$ var=XXXX
$ echo '<td colspan="2"> class="primera" <p class="titu"> Mama One </ p> </ td>' | sed 's|> \([^=<]*\) <|> '"$var"'\1'"$var"' <|'
<td colspan="2"> class="primera" <p class="titu"> XXXXMama OneXXXX </ p> </ td>
$ var='**'
$ echo '<td colspan="2"> class="primera" <p class="titu"> Mama One </ p> </ td>' | sed 's|> \([^=<]*\) <|> '"$var"'\1'"$var"' <|'
<td colspan="2"> class="primera" <p class="titu"> **Mama One** </ p> </ td>

 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Encrypt Plaintext Password?

How do I encrypt a plaintext password that I need hardcoded in a bash script? (3 Replies)
Discussion started by: wyclef
3 Replies

2. Shell Programming and Scripting

Treat Command Output as a File

Hi. Before I've post this question, I have spent hours looking for the solutions but to no avail. Because I think it is possible but I just don't know what is the right keyword to search for. Ok, basically what I want to achieve is really simple. It's just that I don't want to write... (20 Replies)
Discussion started by: aimy
20 Replies

3. Shell Programming and Scripting

awk script modification - treat certain files differently

awk 'BEGIN{OFS=","} FNR == 1 {if (NR > 1) {print fn,fnr,nl} fn=FILENAME; fnr = 1; nl = 0} {fnr = FNR} /UNUSUAL/ && /\.gz/ ~ /FILENAME/ {nl++} <'{system ("gunzip -cd FILENAME")}' END ... (2 Replies)
Discussion started by: SkySmart
2 Replies

4. Shell Programming and Scripting

Automated FTP without plaintext user/password in script

hi , i am a still beginner in unix and specially in ftp i've written this script but my admin asked me that he don't want to see in my ftp neither user neither password , so i've created .netrc file where in it i've put machine name , user and pass but still included in my script , so if someone... (19 Replies)
Discussion started by: semaan
19 Replies

5. Shell Programming and Scripting

[Perl] Same entries in file, but treat them different.

Hi, I could use some help with a program that examines a log file. It should output the duration of the steps in minutes. My problem is that there is no end of a step given, only the begin of a next step. Actually the problem is that this line comes 3 times, but marks 3 different events: ... (6 Replies)
Discussion started by: ejdv
6 Replies

6. UNIX for Dummies Questions & Answers

make script treat * as a regular character

I need a script that reads the out put of a command (softwareupdate --list) and will tally up the number of asterisks in the output and tell me how many there were. How do I go about getting my script to treat asterisks as a regular character and not a wildcard or some other operator? (8 Replies)
Discussion started by: glev2005
8 Replies

7. Shell Programming and Scripting

How to get the difference between dates?Can i treat as string?

Hi All , I have an output value with two columns like this... Days User 10 A 500 B 1 C How i can compare the first column value and passing the user name as parameter? For example : while read -r days If (days<=30) ; then value=days/30 x100 ... (3 Replies)
Discussion started by: EDBGSK
3 Replies

8. Shell Programming and Scripting

awk - treat multiple delimiters as one

Is there anyway to get awk to treat multiple delimiters as one? Particularly spaces... (6 Replies)
Discussion started by: peter.herlihy
6 Replies
Login or Register to Ask a Question