Its creating file /usr/src/myfile_newfile.txt as the variable $1 is correctly used. When $ is assigned to $var, the variable in $var is echoed fine, but the file is not getting created. How can I get the file myfile_newfile_with_var.txt correctly with the above script. ie the variable passed from $1 to $var should work in the line "touch /usr/src/$var_newfile_with_var.txt"
Hey All,
I'm trying to clean up a variable using sed but It dosn't seem to work. I'm trying to find all the spaces and replace them with "\ " (a slash and a space). For Example "Hello World" should become "Hello\ World". But it does nothing. If I put it directly into the command line it works... (3 Replies)
Hi everyone,
I have a simple question to ask :
In a script that I'm writting, I need to create variables on-the-fly.
For instance, for every iterartion of the following loop a var_X variable should be generated :
#!/bin/ksh
a="1 2 3"
for i in $a
do
var_${i}=$i
echo "${var_$i}"
done
... (1 Reply)
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Hi ,
I have a variable as follows,
Temp=`cat ABC.txt | cut -c5-`
This will yeild a part of the date. say , 200912.
I would like to substitute this variable's value in a filename.
eg: File200912F.zip
when i say File$TempF.zip , it is not substituting.
Any help ?
Thanks in... (2 Replies)
When script is running you only see when some of the commands are not successfull.
Is there a way to see which command are executed and to show the substitution of variables as every line is executed ? (3 Replies)
For example I have variable like below
echo $OUTPUT
/some/path/`uname -n`
when I try to use the variable OUTPUT like below
cd $OUTPUT or cd ${OUTPUT}
I am getting bad substituion error message
$ cd $OUTPUT
ksh: cd: bad substitution
$ cd ${OUTPUT}
ksh: cd: bad substitution
... (1 Reply)
Hello, this is probably a simple request but I've been toying with it for a while.
I have a large list of devices and commands that were run with a script, now I have lines such as:
a-router-hostname-C#show ver
I want to print everything up to (and excluding) the # and everything after it... (3 Replies)
if a variable has part of awk syntax stored in it. for eg: x=if($1>100)
can we substitute this variable in an awk statement.
based on above requirement can we execute something like:
awk '{x print $1}' infile (5 Replies)
Hi I am trying to do the following in a script find a string and add in a block of text two lines above on the command line this works fine
#/usr/bin/cat /usr/local/etc/dhcpd.conf_subnet | /usr/xpg4/bin/sed -n -e '1h;1\!H;${;g;s/}.*#END of 10.42.33.0/#START of RANGE $dstart\:option... (3 Replies)
Hi
I am setting the variables like this :
setenv MODULE1 modem5__3
setenv MODULE2 modem5__2
setenv MODULE3 modem_ctrl_1_1
setenv MODULE4 modem_1_0
setenv COUNT 10
I am having a bash script as shown below
################################################
#!/bin/bash
for ((... (5 Replies)
Discussion started by: kshitij
5 Replies
LEARN ABOUT DEBIAN
mojomojo::formatter::file
MojoMojo::Formatter::File(3pm) User Contributed Perl Documentation MojoMojo::Formatter::File(3pm)NAME
MojoMojo::Formatter::File - format file as XHTML
DESCRIPTION
This formatter will format the file argument as XHTML.
Usage: {{file TYPE filename}}
{{file Text uploads/Files/test.txt}}
TYPE is a plugin present in Formatter/File/ directory.
Currently there are only three: Pod, DocBook and Text
The plugin TYPE format only the file which the extension match with 'can_format' method. Respectively pod, xml and txt for existing
plugins.
For security reasons the path of file must be include in 'whitelisting' directory. You can use path_to(DIR) to describe directory in
mojomojo.conf:
Just an example to view the test pod file t/var/files/test.pod :
Add this to mojomojo.conf :
<Formatter::Dir>
prefix_url /myfiles
whitelisting __path_to(t/var/files)__ </Formatter::Dir>
To see the pod content formatted in xhtml, write in the text area:
{{file Pod path_to(t/var/files)test.pod}}
To show recursively all files of directory see script/util/dir2mojomojo.pl script. To test it:
# start mojomojo
./script/mojomojo_server.pl
# run dir2mojomojo script
./script/util/dir2mojomojo.pl --dir=~/dev/mojomojo/t/var/files/ --url=/myfiles
Connect to http://server:3000/myfiles/
METHODS
format_content_order
Format order can be 1-99. The File formatter runs on 92.
format_content
Calls the formatter. Takes a ref to the content as well as the context object.
plugin
Return the plugin to use with file attachment
format
Return the content formatted
checkplugin
Return 0 if plugin exist
checkfile
Directory must be include in whitelisting
SEE ALSO
MojoMojo,Module::Pluggable::Ordered
AUTHORS
Daniel Brosseau <dab@catapulse.org>
LICENSE
This module is licensed under the same terms as Perl itself.
perl v5.14.2 2010-04-07 MojoMojo::Formatter::File(3pm)