Using the script: (Called replaceit)
#!/bin/ksh
String=$1
Replace=$2
sed -e "s/${orig}/${new}/g" oldfile.txt > newfile.txt
In oldfile.txt, I'm looking for: getenv("Work")
And change it To: /u/web
I execute the script:
replaceit "getenv(\""Work\"")" /u/web
I'm getting sed... (3 Replies)
how to escape / (forward slash) in a string.
I have following scnerio:
sed s/${var1}{$var2}
var1 and var2 both contain slashes, but sed gives error if there is a slash in var1 or var2. sed is used here to replace var1 with var2.
Thanks in advance (1 Reply)
Hi all,
I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
What is the significance of the forward slash(/) while specifying a directory?
cp -av /dir/ /opt/
and
cp -av /dir /opt
Does effectively the same job it seems? (2 Replies)
i need to replace '/' forward slash with \/(backward slash follwed by a forward slash) using sed command when the forward slash occurs as a first character in a file..
Tried something like this but doesn't seem to work.
find $1 -print0 | xargs -0 sed -i -e 's/^\//\\\//g'
Can someone... (19 Replies)
I want to replace every 2nd occurance of a string/character from a line.
ababacbsbddbsbbcbdbssb
i want to replace every s2nd b with @ like below
should be like
aba@acbs@ddbs@bc@dbss@ (3 Replies)
hi
hope somebody can help, there seems to be bit on the net about this, but still cant make it work the way i need.
i have a file live this
mm dd ff /dev/name1
mm dd ff /dev/name2
mm dd ff /dev/name3
mm dd ff /dev/name4
i need to update /dev/name1 etc to /newdev/new/name1 etc
so... (5 Replies)
./split2.sh: line 1: split/ssl/pop3s.txt: No such file or directory
sort: cannot read: split/ssl/pop3s.txt: No such file or directory
Hi there,
I am pulling data from the following source:
ssl/http
ssl/http
ssl/http-alt
ssl/https
ssl/https
ssl/https
ssl/https
ssl/https
ssl/https... (3 Replies)
Discussion started by: alvinoo
3 Replies
LEARN ABOUT DEBIAN
mojo::asset::file
Mojo::Asset::File(3pm) User Contributed Perl Documentation Mojo::Asset::File(3pm)NAME
Mojo::Asset::File - File storage for HTTP 1.1 content
SYNOPSIS
use Mojo::Asset::File;
# Temporary file
my $file = Mojo::Asset::File->new;
$file->add_chunk('foo bar baz');
say 'File contains "bar"' if $file->contains('bar') >= 0;
say $file->slurp;
# Existing file
my $file = Mojo::Asset::File->new(path => '/home/sri/foo.txt');
$file->move_to('/yada.txt');
say $file->slurp;
DESCRIPTION
Mojo::Asset::File is a file storage backend for HTTP 1.1 content.
ATTRIBUTES
Mojo::Asset::File inherits all attributes from Mojo::Asset and implements the following new ones.
"cleanup"
my $cleanup = $file->cleanup;
$file = $file->cleanup(1);
Delete file automatically once it's not used anymore.
"handle"
my $handle = $file->handle;
$file = $file->handle(IO::File->new);
File handle, created on demand.
"path"
my $path = $file->path;
$file = $file->path('/home/sri/foo.txt');
File path used to create "handle", can also be automatically generated if necessary.
"tmpdir"
my $tmpdir = $file->tmpdir;
$file = $file->tmpdir('/tmp');
Temporary directory used to generate "path", defaults to the value of the "MOJO_TMPDIR" environment variable or auto detection.
METHODS
Mojo::Asset::File inherits all methods from Mojo::Asset and implements the following new ones.
"add_chunk"
$file = $file->add_chunk('foo bar baz');
Add chunk of data.
"contains"
my $position = $file->contains('bar');
Check if asset contains a specific string.
"get_chunk"
my $chunk = $file->get_chunk($start);
Get chunk of data starting from a specific position.
"is_file"
my $true = $file->is_file;
True.
"move_to"
$file = $file->move_to('/home/sri/bar.txt');
Move asset data into a specific file and disable "cleanup".
"size"
my $size = $file->size;
Size of asset data in bytes.
"slurp"
my $string = $file->slurp;
Read all asset data at once.
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo::Asset::File(3pm)