Sponsored Content
Full Discussion: if and sed statement
Top Forums Shell Programming and Scripting if and sed statement Post 302071777 by chris1234 on Monday 24th of April 2006 01:13:02 PM
Old 04-24-2006
if and sed statement

this is my output for my crawler.

/about.html
/ads/
/advanced_search?hl=en
froogle.google.com/frghp?hl=en&tab=wf&ie=UTF-8
groups.google.com/grphp?hl=en&tab=wg&ie=UTF-8
/imghp?hl=en&tab=wi&ie=UTF-8
/intl/en/options/
/language_tools?hl=en
/maphp?hl=en&tab=wl&ie=UTF-8
news.google.com/nwshp?hl=en&tab=wn&ie=UTF-8
/preferences?hl=en
scholar.google.com/schhp?hl=en&tab=ws&ie=UTF-8
/services/

what i am trying to do is add the website to the beginning of the output
e.g: for instance the first line of the output reads "/about.html" then after the website is added this is what it would read "www.google.com/about.html" i am trying to pass the website through variable "$1". and i am trying to write an if statement to where if the output has "/" in front at the begnning it would add $1 {www.google.com} it will add and if it does'nt it will leave it alone. can anyone help?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variables within a sed statement

I am just wondering if it's possible to refer to variables within a sed statement as follows:- cat $file | sed -e 1's/$oldtext/$newtext/' > $file as when I run the script, the variables are not recognised and nothing happens..?? Thanks (5 Replies)
Discussion started by: sirtrancealot
5 Replies

2. Shell Programming and Scripting

sed remove statement

I am having some problems with sed, that I am hoping that I can get some assistance with. I am trying to remove two subsets of a string, and cannot figure out how to have it work. Here is an example string: auth_ldap authenticate: user joe authentication failed; URI /svn/ I want to... (4 Replies)
Discussion started by: Guyverix
4 Replies

3. UNIX for Dummies Questions & Answers

Case statement/sed command

The file dbnames.txt has 5 columns, what i'm trying to do is that when the fifth column equals A, store in the variable "access" the word, "admin access". If it equals B, then "business access" etc. I think their is a problem with my sed command, because it is not substibstituting the words... (1 Reply)
Discussion started by: ross_one
1 Replies

4. Shell Programming and Scripting

sed / grep / for statement performance - please help

I'm searching the most effective way of doing the following task, so if someone can either provide a working solution with sed or one totally different but more effective then what I've got so far then please go ahead! The debugme directory has 3 subdirectorys and each of them has one .txt file... (7 Replies)
Discussion started by: TehOne
7 Replies

5. Shell Programming and Scripting

A complex sed statement

I have following requirement. Say, my text file contains following patterns {2010501005|XXGpvertex|9|0|17|0|{|{30100001|XXparameter_set|@@@@{{30001002|XXparameter|!prototype_path|$AB_COMPONENTS/Sort/Sort.mpc|3|2|Pf$|@{0|}} }}@0|@315000|78500|335000|99000|114000|87000|17|And the Sort|Ab... (8 Replies)
Discussion started by: Shell_Learner
8 Replies

6. Shell Programming and Scripting

If condition and for loop within sed statement

Hi, I tried to go through a lot of online material but could not find concrete solution. My issues is like this : I've got a input file like this : <a> <startDate>19700101000000</startDate> <endDate>20300101000000</endDate> </a> ... (12 Replies)
Discussion started by: Shaishav Shah
12 Replies

7. Shell Programming and Scripting

sed if statement to see if file exists

Is there an easy way of checking for the existence of a file that ends with the extension .order and if it exists do something? if not do nothing (7 Replies)
Discussion started by: firefox2k2
7 Replies

8. Shell Programming and Scripting

If else statement in sed

Hello Guys, I am new here and this is my first post, hope someone can help me I am writing a script that is supposed to go in 9 different directories and edit a given file in each of the directories. I am using sed to edit the file as sed -i 'line# s/#to be changed/#to be replaced with/... (5 Replies)
Discussion started by: Madiouma Ndiaye
5 Replies

9. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

10. Shell Programming and Scripting

sed within awk statement

input | Jan 8 2018 11:28PM| 24 | 75 | 51 | 1 | 1.600| | Jan 8 2018 12:01PM| 52 | 823 | 21 | 6 | 2.675| desired output Jan-8-2018-11:28PM 24 75 51 1 1.600 Jan-8-2018-12:01PM 52 823 21 6 2.675 Dear friends, I have input file , as shown above and... (10 Replies)
Discussion started by: sagar_1986
10 Replies
HTML::Display(3pm)					User Contributed Perl Documentation					HTML::Display(3pm)

NAME
HTML::Display - display HTML locally in a browser SYNOPSIS
use strict; use HTML::Display; # guess the best value from $ENV{PERL_HTML_DISPLAY_CLASS} # or $ENV{PERL_HTML_DISPLAY_COMMAND} # or the operating system, in that order my $browser = HTML::Display->new(); warn "# Displaying HTML using " . ref $browser; my $location = "http://www.google.com/"; $browser->display(html => $html, location => $location); # Or, for a one-off job : display("<html><body><h1>Hello world!</h1></body></html>"); DESCRIPTION
This module abstracts the task of displaying HTML to the user. The displaying is done by launching a browser and navigating it to either a temporary file with the HTML stored in it, or, if possible, by pushing the HTML directly into the browser window. The module tries to automagically select the "correct" browser, but if it dosen't find a good browser, you can modify the behaviour by setting some environment variables : PERL_HTML_DISPLAY_CLASS If HTML::Display already provides a class for the browser you want to use, setting "PERL_HTML_DISPLAY_CLASS" to the name of the class will make HTML::Display use that class instead of what it detects. PERL_HTML_DISPLAY_COMMAND If there is no specialized class yet, but your browser can be controlled via the command line, then setting "PERL_HTML_DISPLAY_COMMAND" to the string to navigate to the URL will make HTML::Display use a "system()" call to the string. A %s in the value will be replaced with the name of the temporary file containing the HTML to display. %HTML::Display::os_default The hash %HTML::Display::os_default contains pairs of class names for the different operating systems and routines that test whether this script is currently running under it. If you you want to dynamically add a new class or replace a class (or the rule), modify %os_default : # Install class for MagicOS $HTML::Display::os_default{"HTML::Display::MagicOS"} = sub { $^O =~ qr/magic/i }; __PACKAGE__->new %ARGS $browser->display( %ARGS ) Will display the HTML. The following arguments are valid : base => Base to which all relative links will be resolved html => Scalar containing the HTML to be displayed file => Scalar containing the name of the file to be displayed This file will possibly be copied into a temporary file! location (synonymous to base) If only one argument is passed, then it is taken as if html => $_[0] was passed. EXPORTS
The subroutine "display" is exported by default COMMAND LINE USAGE
Display some HTML to the user : perl -MHTML::Display -e "display '<html><body><h1>Hello world</body></html>'" Display a web page to the user : perl -MLWP::Simple -MHTML::Display -e "display get 'http://www.google.com'" Display the same page with the images also working : perl -MLWP::Simple -MHTML::Display -e "display html => get('http://www.google.com'), location => 'http://www.google.com'" AUTHOR
Copyright (c) 2004-2007 Max Maischein "<corion@cpan.org>" LICENSE
This module is released under the same terms as Perl itself. perl v5.10.1 2007-10-20 HTML::Display(3pm)
All times are GMT -4. The time now is 03:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy