Programming :: Insert A Comment In Html File Based On Its Contents?

Jun 10, 2010

I have multiple HTML files in a folder. there is a <h2> tag like this:

Code:

<h2>some text</h2>

in each file. I want to write a shell script/batch file to add this tag in <head> section of each file:

Code:

<!-- TITLE= "same text from h2 tag" -->

Note that <h2>some text</h2> in some files has 1 or more linebreaks and so I couldn't capture tag content using a simple grep or...
for example:

<h2>first part of text
second line of text</h2>

The line break shouldn't be shown in <!-- TITLE= "same text from h2 tag" -->. The script has to capture tag content & skip line breaks.

View 3 Replies


ADVERTISEMENT

Programming :: VBA / Excel - Looping Through Image Controls Based On Cell Contents?

Jun 28, 2011

I have an Excel Spreadsheet which reports upon weekly performance. One portion of the worksheet looks at week over week increases /decreases. I've placed a number of image controls (15 in Total) next to cells which calculate week over week change. The image controls simply display an image depending on whether the value of the adjacent cell is positive or negative. So, here is my basic working IF statement:

Code:

Private Sub Worksheet_Change(ByVal UpDown As Range)
If Range("J26") > 0 And IsNumeric(Range("J26").Value) Then
Image1.Picture = LoadPicture("C:path oup_arrow.gif")
ElseIf Range("J26") < 0 And IsNumeric(Range("J26").Value) Then

[code]....

As you can see, this is pretty simple. What I'd like to do is find a way to loop through all 15 controls and avoid having 15 IF statements run on the Worksheet_Change() event. The cells containing the week over week values are all in the same column, but not continuous. Involved cells are: ("J26", "J27", "J33", "J34", "J35", "J36", "J37", "J38", "J39", "J40", "J42", "J43", "J44", "J45", "J46")

View 6 Replies View Related

Programming :: Search For A Word In A File And Then Comment It Or Delete It?

Aug 9, 2009

I want to know that how can i search for a word in a file and then comment it or delete it. I know this command works.

sed 's/word/#word/'g inputfile > outputfile

But the lines in my input file are as under:

zone "abc.com" { ---- This line can be comment
type master; ----- This line repeat again and again in the file
file "abc.txt";
allow-query { any; }; -This line repeat again and again in the file
};

I want to know how can i comment a certain zone.

View 8 Replies View Related

Programming :: Script To Read Active Squid Logfile And Output Results To Html Based On Conditions?

Mar 12, 2010

Basically the requirement of the script are :

1. need to run like a daemon which will read an active squid logfile in a refresh pattern of 5 minutes

2. calculate the total number requests based on different domains that the client access

3. calculate the total of number of requests based on different domains as well as the turnaround time of these access is more than 5 sec that the client access

4. calculate percentage of item 3 over item 2

5. report the results in html format as follows:

Domain Name Total req Req > 5 sec % of req > 5 sec

6. able to access the results from web browser.

View 8 Replies View Related

Programming :: Insert Each Line Of One File To The Another File After Certain Lines?

Jul 2, 2010

i have two files with thousands of line, I am trying to combine these two files but i want to insert each line of one file to the another file after certain lines. I am using awk with the following command but it does not work.cat file1 | awk ' { print $0; if (NR%3004==0) {print "file2"}}' > outputfile

View 14 Replies View Related

Programming :: Insert Graphics Into Latex File?

May 30, 2011

I want to insert graphics into latex file, for longtime I used xfig to create graphs, but it is limited,specially for math formulas, dia i find not easy to use.Finally I want to try asymptote or tikz which one is more appropriate

View 1 Replies View Related

Programming :: Insert A Line In The Test File With Sed?

Jul 15, 2010

I have following file workers file: There are 800 entries like this.

# consensus/uat
worker.consensus-uat1.host=lonlx10409
worker.consensus-uat1.port=13702
worker.consensus-uat1.type=ajp13

[code]....

I want to insert one line just below the line starting with "woker.list". I think sed can do it but I am not aware.

View 14 Replies View Related

Programming :: Converting A HTML File To A PNG File Through Python Script?

Jan 29, 2010

I have managed to create a HTML file inside python code,convert this to a PNG file through a Python script ?

EDIT: Details added: I have a python script which generates map-legends in the form of an html file. The legend generated have to be pasted on a map which is in a png format. A png format file can be pasted on another png format file easily. But because the legends generated are in a html format I cannot paste it on the map file !!

EDIT: Details added: I did Googling first but it resulted in various soft wares for above purpose which I don't want !!

View 12 Replies View Related

Programming :: Append Contents Of One File To Another Existing File?

Nov 17, 2008

I have two files list1.cfg and list2.cfg both files contains differentrecords details like

List1.cfg
NAME1:25:C:NAME LINE1:
NAME2:25:C:NAME LINE2:
CITY:25:C:City:

[code]....

Now I want to append contents list2.cfg to list1.cfg(It ispposible using cat list2.cfg >>list1.cfg) but I want to check if content of (record) in list2.cfg is present in list1.cfg then dont append it otherwise append it.

View 1 Replies View Related

Programming :: Sed To Read The File And Replace And Insert The Pattern?

Jun 11, 2009

I want to read from the file and check for the pattern, if the line has some word like <string>: then string should be copied into buffer. Afterwards, I want to insert the same <string> with some word in the next line of the file. use sed command to perform the above mentioned operations?

View 2 Replies View Related

Programming :: Locate A File By It's Contents?

Jul 16, 2011

A long time ago I wrote a short essay about the 'federal' 'reserve' board. I don't remember it's name or format. I think it's somewhere on my rather large hard discs (to of them divided into various partitions).I'm trying to write a command line that will find it based on a quote that is in it: "our fathers brought forth"I have tried various configurations of grep, and or combining grep with find, but I'm getting nowhere. I really don't understand the syntax of either command, or how they work together, and the examples that I can find are really no help at all.

View 6 Replies View Related

Programming :: Read The Contents Of A File?

Jan 11, 2010

I am trying to read the contents of a file into something else. I have a file.txt that I am working with, I want to read the file and take the data and run some commands with the data that it read. So if it read www.yahoo.com I want to be able to nslookup. Does that make sense? I have been trying to use the read command but that does not seem to work. I even was trying to read filename | > filename to see if I could even read any of the data at all. Nothing is working.

View 8 Replies View Related

Programming :: Check If File Contents In Another File?

Nov 4, 2009

i am trying to write a bash script. i have a text file called comp2.tmp which has a list of items in it

example comp2.tmp

Code:

filename.pdf
filename2.zip
filename3.ttf
and so on

I have another text file called comp1.tmp which should have the same list of files in it, but does not look as pretty

example comp1.tmp

Code:
someothertext here ...... 10/30/2009 ...... filename.pdf
=========================------------------==============
othertextagain .......... 09/28/2008 ...... filename2.zip
========================------------------===============
bunchmoretext ........... 04/12/2005 ....... filename3.ttf
and so on

i would like to check if the filenames listed in comp2.tmp exists in comp1.tmp

View 3 Replies View Related

Programming :: Watching File Contents Continously?

May 27, 2010

want to watch the file continoulsy for any newly written data to file.Presently i am periodically opening the file and checking for the newly updated contents.Is there something like refresing the file descriptor, since open is a system call, calling it many times may affect performance. Does the tail program opens file multiple times to check for the updated contents when used with -f option.Can some one explain or give some links on how the filedescriptors remembers its end contents while some other programs keeps updating the file.

View 5 Replies View Related

Programming :: Sed One-liner: Search Text In File And Replace It - If Not Present Insert It?

Oct 16, 2010

As indicated in the subject, I want to search a text. If the text is present I want to replace it. But if the text is not present, I want to insert it after first line and before last line.

Searched text is:CleanCache "*";

Where * can be anything.

Example: CleanCache "false"; -> CleanCache "true";

If CleanCache "false"; is not present, only insert CleanCache "true"; after first line and before last line.

View 8 Replies View Related

Programming :: Cutting An Html File Apart - Perl - Sed - Awk?

Apr 13, 2010

I have an html file like this

HTML Code:

Some more HTML code... I would like to cut the above text so i get this: Sometext on multiple lines like this.Sometext on multiple lines like this.Sometext on multiple lines like this. Sometext on multiple lines like this.Sometext on multiple lines like this.

There are other HTML files with similar cuts I need to do, but once I have the method for doing one, I am sure I can do the others.

I think the two logical strings to cut between would be:

I am not sure if these strings are always the start and end of the line respectively, is this makes a lot of difference! Then the HTML tags would need to be stripped to get the text on its own.

I know the commands for removing tags, but searching for a string like class="IOSSectionTitle", and cutting everything before it etc is something I am finding challenging.

Just thought I would add that the HTML does not nec. appear on logical new lines throughout the file and there may be unexpected new lines, but as far as i know the class="IOSSectionTitle" and <img always appears as a string without any new lines between those characters.

View 4 Replies View Related

Programming :: Add HTML Formatting To Text File?

Jun 30, 2010

I need to extract som text from a text file. The text is a test log with system info at the top and results further down. What I need is to add different tags with formatting before and after each line. I have prepared a template with html formatting, but the number of lines in the test log may be different from case to case, so I need to be able to add formatting tags by need. Can this be done using bash script, sed, awk, head, tail... ?

View 4 Replies View Related

Programming :: BASH: Listing Contents Of .zip File Into An Array?

May 18, 2010

I want to list the contents of a zip file amd put each entry into an array. I've been doing

[code]....

View 4 Replies View Related

Programming :: Read Text File (Distribute Its Contents)

Jan 22, 2011

How can read the file /var/etc/allInOne.cfg and distribute its contents on multiple cfg files using C language. /var/etc/allInOne.cfg contain the data and the path of each text file.

The source file "/var/etc/allInOne.cfg "look like this:
line1
line2
...
line10
filePath:/var/etc/file1.cfg
line12
line13
...
line14
filePath:/var/etc/file2.cfg
linen
..
filePath:/var/etc/filen.cfg
the result will be :

The expected result is:
/var/etc/file1.cfg will contain line1 to line10
/var/etc/file2.cfg will contain line 12 to line13
/var/etc/filen.cfg will contain linen to linen-1

View 13 Replies View Related

Programming :: Splitting A File Based On The Values Read From An Input File?

Jul 27, 2010

I am splitting a file based on the values read from an input file. The below one is the script.

1)How do I add the header which is present in the original file to the new split files created?(For eg. pharmacyf conatins header as table column names. The new files created (ODS.POS.$pharmacyid.$tablename.$CURRENT_DATE.dat) are without the header).

2) Also the script is creating 0 byte files for the pharmacyids which are not available in the intial file? Can this be avoided?

for pharmacyf in *
do
tablename=`echo $pharmacyf |cut -f4 -d'.' `
while read pharmacyid
do
grep -w $pharmacyid $pharmacyf >> $OUT/ODS.POS.$pharmacyid.$tablename.$CURRENT_DATE.dat
done< inputfile
done

View 2 Replies View Related

Programming :: Script To Create Index.html File?

Sep 25, 2010

I need a script that can do this: A script that searches all directories and subdirectories for .html files When a .html file is found it creates a index.html file in that folder. It then edits the index.html file and inserts links to all of the .html files that are in that folder into the body. If no .html files are found, it searches for folders. It then creates a index.html file with links to all of the folders.

View 4 Replies View Related

Programming :: Arrays In Awk - Take Some Data From A File - Ssh Log - And Print It To A Html Table

Feb 7, 2011

I have a problem with arrays in awk. What i want is to take some data from a file (ssh log) and print it to a html table. I have managed to print some stuff (user logged in and how many times they have logged in) What i want more is to take all the ip that each user logged in from and print it in a row next to the username and times (in the code i typed blabbla where i want the ip to be shown. How do you think i should approch that, multidimensional arrys maybe?

Code:

View 14 Replies View Related

Programming :: Script To Create Simple HTML From Text File?

Oct 1, 2009

I am working on a script to convert a comma seperated text file into html code line by line. The text file is like so:

Code:

link url, image url, description and I want it to output this:

Code:

<td><a href=�link url�><img src="image url" alt=�description" /></a></td>

Here is what I have so far:

Code:

#!/bin/bash
var1='<td><a href=
var2='><img src="'
var3='" alt=�thumbnail image" /></a></td>'

[code].....

It puts the entire line into the html so its no good. I'll probably need to use awk (I think).

View 5 Replies View Related

Programming :: Client Side To Include HTML Within HTML?

Sep 12, 2009

what is the best way (i.e standard way that is supported on all browsers and probably as well followed by web crawlers).... to include an html file either locally or externally in another ? Of course , i've done the research and i also know that there are server side includes (php , asp ...you name it) at the moment , i'm using this:

Quote:

<script type="text/javascript" src="path to file/include-file.js"> </script>

however, i've been warned that this method may not show up in some browsers as some tend to ignore this tag and that crawlers like your favorite search engine wouldn't bother reading this. so , what is the best and safest way to do the job? and btw , the reason why i've ousted SSI's from the start is because of among other things:

1) the fact that the included file is static html and because the text is included pretty much everywhere

2) hoping to reduce load time as the code (if successfully recognized) would hopefully be treated like any other embedded external file (e.x like an image) , therefore it would be cached without the need to downloaded it over and over again for each new page on the site.

View 1 Replies View Related

Programming :: Parse A File Using Html Parser By Libxml - Undefined Reference

Jan 13, 2011

iḿ trying to parse a file using html parser by libxml.

Code: #include <stdio.h>
#include <libxml/HTMLparser.h>
#include <string.h>
void main(){
printf("main
");
[Code]....

View 4 Replies View Related

Programming :: Is There Pseudocode Comment Convention?

Nov 18, 2010

While writing pseudocode is there a convention for writing comments within the pseudocode?

View 4 Replies View Related

Debian Programming :: HTML Export - Consolidate Several Lines Of CSV File With Firewall Rules

Oct 11, 2013

I have a CSV file, which I created using an HTML export from a Check Point firewall policy. Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or services.

I need the output to have each rule described in only one line. It's easy to distinguish when each rule begins. In the first column, there's the rule ID, which is a number.

Here's an example. In green are marked the strings that should be moved:

See example. The strings that should be moved are in bold:

NO.;NAME;SOURCE;DESTINATION;SERVICE;ACTION;
1;;fwgcluster;mcast_vrrp;vrrp;accept;
;;;;igmp;;
2;Testing;fwgcluster;fwgcluster;FireWall;accept;
;;fwmgmpe;fwmgmpe;ssh;;
;;fwmgm;fwmgm;;;

What I need ,explained in pseudo code, is this:

Read the first column of the next line. If there's a number:

Evaluate the first column of the next line. If there's no number there, concatenate (separating with a comma) the strings in the columns of this line with the last one and eliminate the text in the current one

The output should be something like this. The strings in bold are the ones that were moved:

NO.;NAME;SOURCE;DESTINATION;SERVICE;ACTION;
1;;fwgcluster;mcast_vrrp;vrrp-igmp;accept;
;;;;;;
2;Testing;fwgcluster-fwmgmpe-fwmgm;fwgcluster-fwmgmpe-fwmgm;FireWall-ssh;accept;
;;;;;;

The empty lines are there only to be more clear, I don't actually need them.

View 1 Replies View Related

Programming :: API To Get Partition Name Based On File Path In C On OS?

Jul 19, 2011

Is there any API to get partition name based on file path in C on Linux OS?

View 1 Replies View Related

General :: Generate Html Based On Directory Structure?

Jul 22, 2010

does any one knows a linux based program/script that can generate html files based on directory structure?

View 1 Replies View Related

General :: What GUI Linux Programs Are There For Finding Files Based Upon Their Contents?

Sep 18, 2010

What GUI Linux programs are there for finding files based upon their contents?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved