11-12-2013
Question about writing a bash script
Hello,
I want to write a bash script to delete the content after '#'. However, if '#' appears in a string with "", ignore this. For example,
input file:
test #delete
"test #not delete"
Output file:
test
"test #not delete"
Does anyone know how to write this script?
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm getting the following errors when I try to write a script to unzip some zip files. When I use the free trial copy of the commerical winzip program, however, they work fine. When I use -l or -t on unzip it indicates no errors. When I use the -o switch interactively from the bash command line it... (1 Reply)
Discussion started by: siegfried
1 Replies
2. Shell Programming and Scripting
Could anyone help me to Write a script in BASH Shell to determine the percentage of system disk space you are using. (1 Reply)
Discussion started by: boris
1 Replies
3. Shell Programming and Scripting
Hi,
I want to create a script that gets a filename as an argument.
The script should generate a listing in long list format of the current directory, sorted by file size.
This list must be written to a new file by the filename given on the command line.
Can someone help me with this?
... (6 Replies)
Discussion started by: I-1
6 Replies
4. Shell Programming and Scripting
I want to write a bash script to:
1. Send an email from localhost to an external gmail account. (gmail then automatically forwards the message back to a pop account on the same server.
2. Script waits 3 minutes then checks to see if the email arrived, and if not, it sends an email to... (9 Replies)
Discussion started by: sallyanne
9 Replies
5. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a shell script that allows the user to run the following commands:
ps
top
cmp
netstat
Once ... (3 Replies)
Discussion started by: qbnlnk
3 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I have just gotten into writing bash scripts for a class, part of the assignment is to read and be able to tell... (4 Replies)
Discussion started by: Byrang
4 Replies
7. Shell Programming and Scripting
Im trying to write a script using the host command but its not working properly. I cant understand what Im doing wrong. When I use it at the command prompt, it works fine. But its being used actually in the script, it says its not found: 2 SERVFAIL. Can anyone help me? Here's what I have so far: no... (6 Replies)
Discussion started by: relsha
6 Replies
8. Shell Programming and Scripting
Hi,
I need to automate some repacking tasks of a boot image for Android
When in command line, I can use this command:
mkbootfs /path/to/root > /path/to/ramdisk-recovery.cpio;However, if I try to run the command from a shell script under Ubuntu, it fails and outputs to stdout instead of the... (27 Replies)
Discussion started by: Phil3759
27 Replies
9. Shell Programming and Scripting
Hi,
I wanted to load data from HDFS to HIVE by writing bash script.
Description:
I have written a bash script to validate the data and loaded validated data from local file system to HDFS. Now in the same bash script i wanted to load the data from HDFS to HIVE. How can i do it ? Also how tyhe... (2 Replies)
Discussion started by: shree11
2 Replies
10. Shell Programming and Scripting
Hi,
I have a script file where i'm validatig the input file and storing the validated records on HDFS.
I wanted to load data from HDFS to HBASE using pig script. So for that i have created a HBASE table and written pig script to load data from HDFS to HBASE which is working fine. Now i wanted... (0 Replies)
Discussion started by: shree11
0 Replies
LEARN ABOUT DEBIAN
xen-delete-image
XEN-DELETE-IMAGE(8) Perl Programmers Reference Guide XEN-DELETE-IMAGE(8)
NAME
xen-delete-image - Delete previously created Xen instances.
SYNOPSIS
xen-delete-image [options] [--hostname=]imageName1 [--hostname=]imageName2
Help Options:
--help Show help information.
--manual Read the manual for this script.
--version Show the version information and exit.
--verbose Show diagnostic output.
General options:
--dir Specify the output directory where images were previously saved.
--evms Specify the EVMS container to use.
--lvm Specify the LVM volume to use.
Specifying hosts:
--hostname Specify the image name to delete.
Testing options:
--test Don't complain if we're not invoked by root.
OPTIONS
--dir Specify the output directory where images were previously saved.
--evms Specify the EVMS container where images were previously saved.
--help Show help information.
--hostname Specify the hostname to delete.
--lvm Specify the LVM volume group where images were previously saved.
--manual Read the manual for this script.
--test Do not complain, or exit, if the script is not executed by the root user.
--version Show the version number and exit.
DESCRIPTION
xen-delete-image is a simple script which allows you to delete
Xen instances which have previously been created by xen-create-image.
You must be root to run this script as it removes the Xen configuration
file from /etc/xen and potentially removes LVM and EVMS volumes.
(When invoked with the '--test' flag the script will continue running,
but will fail to remove anything which the user does not have permission
to delete.)
LOOPBACK EXAMPLE
Assuming that you have three images 'foo', 'bar', and 'baz', stored
beneath /home/xen the first two may be deleted via:
xen-delete-image --dir=/home/xen foo bar
You may also delete them by running:
xen-delete-image --dir=/home/xen --hostname=foo --hostname=bar
(The matching Xen configuration files beneath /etc/xen will also be
removed.)
LVM EXAMPLE
Assuming that you have the volume group 'skx-vol' containing three
Xen instances 'foo', 'bar', and 'baz' the first two may be deleted via:
xen-delete-image --lvm=skx-vol foo bar
This will remove the volumes 'foo-disk', 'foo-swap', 'bar-disk',
and 'bar-swap'.
Note that if the images were created with "--noswap" then the swap
volumes will not be present, so will not need to be deleted.
The Xen configuration files will also be removed from beneath /etc/xen.
EVMS EXAMPLE
Assuming that you have the container 'mycontainer' containing three
Xen instances 'foo', 'bar', and 'baz' the first two may be deleted via:
xen-delete-image --evms=lvm2/mycontainer --hostname=foo --hostname=bar
This will remove the volumes 'foo-disk', 'foo-swap', 'bar-disk',
and 'bar-swap'.
Note that if the images were created with "--noswap" then the swap
volumes will not be present, so will not need to be deleted.
The Xen configuration files will also be removed.
AUTHORS
Steve Kemp, http://www.steve.org.uk/
Axel Beckert, http://noone.org/abe/
StA~Xphane Jourdois
LICENSE
Copyright (c) 2005-2009 by Steve Kemp, (c) 2010 by The Xen-Tools Development Team. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the
full text of the license.
4.3.1 2012-06-30 XEN-DELETE-IMAGE(8)