I'm writing my first bash function, and I'm having a little bit of trouble getting used to the syntax. I have been told that it is very similar to Java, but I'm still not quite getting it.
The situation that I am dealing with is checking the values on input fields. There will be anywhere between two and five fields, so the code has to be able to adapt. The fields with either be a string, or a number. This is what I have so far...I am also using the match function, which I have never used before.
This function takes place within a file, which is used as a set of rules to be executed in an awk statement.
So, my question is, is there a way to have a pointer for the current field? I need to check each one, one by one, every time. I haven't been able to find this answer anywhere else, so I'm hoping someone can help me out.
Also, does the function in bash take parameters? Or would it be executed get( current field variable...???) or currentfieldvariable.get()?
I don't really need help with the "do something else" part of the code, because I know how to do it.
If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it:
(1) one is to pass a pointer-to-pointer parameter, like:
int my_malloc(int size, char **pmem)
{
*pmem=(char *)malloc(size);
if(*pmem==NULL)... (11 Replies)
I want to sort alphabetically on the first field and sort in descending numerical order on the 2nd field. With a normal "sort -r -n" it does this:
abc ||| 5e-05 ||| bla
abc ||| 3 ||| ble
def ||| 1 ||| abc
def ||| 0.2 ||| def
As you can see it ignores the fact that 5e-05 is actually 0.00005... (1 Reply)
Hi,
I have a comma delimited file that contains name, account number, and account date/time(example record below). I want to pull off all the records that have an account date greater than 8/1 of the current year, and create a new file with those records. So for this year, it would take... (6 Replies)
Hi, all
I need to get fields in a line that are separated by commas, some of the fields are enclosed with double quotes, and they are supposed to be treated as a single field even if there are commas inside the quotes.
sample input:
for this line, 5 fields are supposed to be extracted, they... (8 Replies)
First, thanks for the help in previous posts... couldn't have gotten where I am now without it!
So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following:
If $1... (4 Replies)
Hi Guys
I have the following file
Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above:
Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Hi Everyone,
New to the forum, and have my first question.
I have the following Macro currently being used within Telnet to run a report for the date being entered. However, now I need the Macro to input the day after today to the the day after today.
Example: If today is May 9, 2012 - the... (0 Replies)
I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below:
column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10
"12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Table
ACN|NAME|CITY|CTY|NO1|NO2
115|AKKK|ASH|IND|10|15
115|AKKK|ASH|IND|20|20
115|AKKK|ASH|IND|30|35
115|AKKK|ASH|IND|30|35
112|ABC|FL|USA|15|15
112|ABC|FL|USA|25|20
112|ABC|FL|USA|25|45
i have written shell script using cut command
and awk programming getting error correct it and add... (5 Replies)
Discussion started by: udhal
5 Replies
LEARN ABOUT OSX
java_home
java_home(1) General Commands Manual java_home(1)NAME
java_home - return a value for $JAVA_HOME
SYNOPSIS
/usr/libexec/java_home [options]
DESCRIPTION
The java_home command returns a path suitable for setting the JAVA_HOME environment variable. It determines this path from the user's
enabled and preferred JVMs in the Java Preferences application. Additional constraints may be provided to filter the list of JVMs avail-
able. By default, if no constraints match the available list of JVMs, the default order is used. The path is printed to standard output.
OPTIONS -v or --version version
Filters the returned JVMs by the major platform version in "JVMVersion" form. Example versions: "1.5+", or "1.6*".
-a or --arch architecture
Filters the returned JVMs by the architecture they support. Example architectures: "i386", "x86_64", or "ppc".
-d or --datamodel datamodel
Filters the returned JVMs capable of running in 32 or 64-bit mode. Supported datamodels: "-d32" and "-d64". Specifying a datamodel
is synonymous with specifying a particular architecture.
-t or --task task
Selects from the list of JVMs which can run a specific task. The order of each of these lists is set by the Java Preferences appli-
cation. Supported tasks: "Applets", "WebStart", "BundledApp", "JNI" and "CommandLine". The default task is "CommandLine".
-F or --failfast
Immediately fails when filters return no JVMs; does not print out the path to the default $JAVA_HOME.
--exec command ...
Executes the command at $JAVA_HOME/bin/<command> and passes the remaining arguments. Any arguments to select which $JAVA_HOME to use
must precede the --exec option.
-X or --xml
Prints the list of selected JVMs and associated properties as an XML plist to stdout.
-V or --verbose
Prints the matching list of JVMs and architectures to stderr.
-h or --help
Brief usage information.
USAGE
/usr/libexec/java_home helps users set a $JAVA_HOME in their login rc files, or provides a way for command-line Java tools to use the most
appropriate JVM which can satisfy a minimum version or architecture requirement. The --exec argument can invoke tools in the selected
$JAVA_HOME/bin directory, which is useful for starting Java command-line tools from launchd plists without hardcoding the full path to the
Java command-line tool.
Usage for bash-style shells:
$ export JAVA_HOME=`/usr/libexec/java_home`
Usage for csh-style shells:
% setenv JAVA_HOME `/usr/libexec/java_home`
04 August 2010 java_home(1)