Hi guys,
I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help.
I have 2 input files (example given below)
Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Hi All,
Can we pass arguments while calling the perl script and as well as ask user input during execution of the script?
My program is as below:
I am passing arg1 and arg2 as argements to test.pl
]./test.pl arg1 arg2
Inside the test.pl I have :
print "Do you want a name ? (y/n) : ";... (2 Replies)
Hello,
I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall:
I regularly need to delete files from many directories.
A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
HI
i have written a script to ask input from the user.
this script should promote the user for y/n input. if user enters anyother input then y/n
the script promotes him again. this below code is working fine for all the cases.
except for space and enter " if i give space and enter it is... (2 Replies)
Hi,
I need to get input arguments, as well as validate them. This is how I'm reading them:
#!/bin/bash
args="$@" # save arguments to variable
## Read input arguments, if so
while ; do
case $1 in
-v | --verbose ) verbose=true;;
-z | --gzip ) compression="gz";;
... (3 Replies)
Dear Friends,
I am looking for a shell script to merge input files into one file .. here is my idea:
1st paramter would be outfile file (all input files content)
read all input files and merge them to input param 1
ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints.
1. The problem statement, all variables and given/known data:
How do I write a shell script that takes in a file or... (4 Replies)
Hi,
I am using awk here.
Inside an awk script, I have a variable which contains a very long XML data in string format (500kb).
I want to pass this data (as argument) to curl command using system function.
But getting Too many arguments error due to length of string data(payloadBlock).
I... (4 Replies)
This script is running some exe file we are passing three argumnet below custome key word
Want to update script based on input files every time it will take argument from input file
below is the input files should take this input put it into the script.
k.ksh
cd /u/kali/temp
... (8 Replies)
Discussion started by: Kalia
8 Replies
LEARN ABOUT DEBIAN
ipsec_optionsfrom
IPSEC_OPTIONSFROM(3) 16 Oct 1998 IPSEC_OPTIONSFROM(3)NAME
ipsec_optionsfrom - read additional ``command-line'' options from file
SYNOPSIS
#include <freeswan.h>
const char *optionsfrom(char * filename, int * argcp, char *** argvp, int optind, FILE * errsto);
DESCRIPTION
Optionsfrom is called from within a getopt_long(3) scan, as the result of the appearance of an option (preferably --optionsfrom) to insert
additional "command-line" arguments into the scan immediately after the option. Typically this would be done to pick up options which are
security-sensitive and should not be visible to ps(1) and similar commands, and hence cannot be supplied as part of the actual command line
or the environment.
Optionsfrom reads the additional arguments from the specified filename, allocates a new argument vector to hold pointers to the existing
arguments plus the new ones, and amends argc and argv (via the pointers argcp and argvp, which must point to the argc and argv being
supplied to getopt_long(3)) accordingly. Optind must be the index, in the original argument vector, of the next argument.
If errsto is NULL, optionsfrom returns NULL for success and a pointer to a string-literal error message for failure; see DIAGNOSTICS. If
errsto is non-NULL and an error occurs, optionsfrom prints a suitable complaint onto the errsto descriptor and invokes exit with an exit
status of 2; this is a convenience for cases where more sophisticated responses are not required.
The text of existing arguments is not disturbed by optionsfrom, so pointers to them and into them remain valid.
The file of additional arguments is an ASCII text file. Lines consisting solely of white space, and lines beginning with #, are comments
and are ignored. Otherwise, a line which does not begin with - is taken to be a single argument; if it both begins and ends with
double-quote ("), those quotes are stripped off (note, no other processing is done within the line!). A line beginning with - is considered
to contain multiple arguments separated by white space.
Because optionsfrom reads its entire file before the getopt_long(3) scan is resumed, an optionsfrom file can contain another --optionsfrom
option. Obviously, infinite loops are possible here. If errsto is non-NULL, optionsfrom considers it an error to be called more than 100
times. If errsto is NULL, loop detection is up to the caller (and the internal loop counter is zeroed out).
EXAMPLE
A reasonable way to invoke optionsfrom would be like so:
#include <getopt.h>
struct option opts[] = {
/* ... */
"optionsfrom", 1, NULL, '+',
/* ... */
};
int
main(argc, argv)
int argc;
char *argv[];
{
int opt;
extern char *optarg;
extern int optind;
while ((opt = getopt_long(argc, argv, "", opts, NULL)) != EOF)
switch (opt) {
/* ... */
case '+': /* optionsfrom */
optionsfrom(optarg, &argc, &argv, optind, stderr);
/* does not return on error */
break;
/* ... */
}
/* ... */
SEE ALSO getopt_long(3)DIAGNOSTICS
Errors in optionsfrom are: unable to open file; attempt to allocate temporary storage for argument or argument vector failed; read error in
file; line too long.
HISTORY
Written for the FreeS/WAN project by Henry Spencer.
BUGS
The double-quote convention is rather simplistic.
Line length is currently limited to 1023 bytes, and there is no continuation convention.
The restriction of error reports to literal strings (so that callers don't need to worry about freeing them or copying them) does limit the
precision of error reporting.
The error-reporting convention lends itself to slightly obscure code, because many readers will not think of NULL as signifying success.
There is a certain element of unwarranted chumminess with the insides of getopt_long(3) here. No non-public interfaces are actually used,
but optionsfrom does rely on getopt_long(3) being well-behaved in certain ways that are not actually promised by the specs.
16 Oct 1998 11/14/2008 IPSEC_OPTIONSFROM(3)