$ echo |awk ' BEGIN {"date" | getline current_time;close("date");print "Report printed on " current_time}'
Report printed on Thu May 11 14:57:29 METDST 2006
This example works fine but how can i print all the output when is longer... (3 Replies)
hello collegues,
I am attempting to use awk to search file1 (serverlist.csv) from each row with file2 (supported.txt). If the is no entry exists in serverlist then output to a file called notsupp.out if there is an entry output to supp.out
I can do this with basic shell scripting however... (0 Replies)
Hello,
Need some help here. I have this script (test.sh):
#!/bin/sh
var=$1
(( var = 2 * var ))
echo $var
Now I want to call this script from awk with one argument and then capture the result in a variable, something like:
echo 40 | awk ' { x = $1; "test.sh " x | getline y; print y }... (1 Reply)
How do you make the getline function return to the original line?
The example below should make it clear where I am currently going wrong.
Thanks
AWK SCRIPT:
-------------
awk -F '-' '{
tmpLine = "EMPTY"
print "CURRENT LINE :"$0
getline tmpLine
print "NEXT LINE :"tmpLine
}'... (1 Reply)
I am using awk and want to use getline from a file like below
getline x < file
However file consists of two columns and I only want to store $2
Any way I can do this?
---------- Post updated at 06:54 AM ---------- Previous update was at 06:45 AM ----------
Done something like this.... (1 Reply)
Hi there, I have an ifconfig output and i want to write a script that determines whether there is a line "groupname ipmp" on a particular interface
here is my example ifconfig -a output
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1... (2 Replies)
Greetings,
I have about 3000 files that I want to search. The first column in all of these 3000 files has a unique serial number on each line. The subsequent columns have lots of data.
I have another masterfile with three columns to help me find all the data I need in a moments notice:
col 1... (15 Replies)
I want to import a textfile with getline into var t which has several lines. How do import all lines, since it only imports the last line:
while < ((getline t "textfile") > 0) (7 Replies)
Hello,
I want to print out the DNA sequence entries (tens of thousand!) that are longer than certain value (i=200) from a file (FASTA file) as:
>S94D_ctg_8004 Average coverage: 402.95
ATAATGCCTGTGAATATGACATGTGTTCCTGTTTCTACATCAGACTACTATTCTTGCATA... (12 Replies)
Hi,
I have an awk script with the following function in it .
function cmd( c )
{
while( ( c | getline foo) > 0 ){
return foo ;
close( c );
}
}
c =... (4 Replies)
Discussion started by: MetaMan
4 Replies
LEARN ABOUT CENTOS
bundle-exec
BUNDLE-EXEC(1)BUNDLE-EXEC(1)NAME
bundle-exec - Execute a command in the context of the bundle
SYNOPSIS
bundle exec command
DESCRIPTION
This command executes the command, making all gems specified in the Gemfile(5) available to require in Ruby programs.
Essentially, if you would normally have run something like rspec spec/my_spec.rb, and you want to use the gems specified in the Gemfile(5)
and installed via bundle install(1) bundle-install.1.html, you should run bundle exec rspec spec/my_spec.rb.
Note that bundle exec does not require that an executable is available on your shell's $PATH.
BUNDLE INSTALL --BINSTUBS
If you use the --binstubs flag in bundle install(1) bundle-install.1.html, Bundler will automatically create a directory (which defaults to
app_root/bin) containing all of the executables available from gems in the bundle.
After using --binstubs, bin/rspec spec/my_spec.rb is identical to bundle exec rspec spec/my_spec.rb.
ENVIRONMENT MODIFICATIONS
bundle exec makes a number of changes to the shell environment, then executes the command you specify in full.
o make sure that it's still possible to shell out to bundle from inside a command invoked by bundle exec (using $BUNDLE_BIN_PATH)
o put the directory containing executables (like rails, rspec, rackup) for your bundle on $PATH
o make sure that if bundler is invoked in the subshell, it uses the same Gemfile (by setting BUNDLE_GEMFILE)
o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby programs invoked in the subshell can see the gems in the bundle
It also modifies Rubygems:
o disallow loading additional gems not in the bundle
o modify the gem method to be a no-op if a gem matching the requirements is in the bundle, and to raise a Gem::LoadError if it's not
o Define Gem.refresh to be a no-op, since the source index is always frozen when using bundler, and to prevent gems from the system leak-
ing into the environment
o Override Gem.bin_path to use the gems in the bundle, making system executables work
o Add all gems in the bundle into Gem.loaded_specs
Shelling out
When shelling out (using the system or backticks methods, for example), Bundler's environment changes will propagate to the subshell envi-
ronment. If you desire to shell out without Bundler's environment changes, simply employ the with_clean_env method. It will restore all
environment variables to what they were before Bundler was activated. For example:
Bundler.with_clean_env do
`brew install wget`
end
RUBYGEMS PLUGINS
At present, the Rubygems plugin system requires all files named rubygems_plugin.rb on the load path of any installed gem when any Ruby code
requires rubygems.rb. This includes executables installed into the system, like rails, rackup, and rspec.
Since Rubygems plugins can contain arbitrary Ruby code, they commonly end up activating themselves or their dependencies.
For instance, the gemcutter 0.5 gem depended on json_pure. If you had that version of gemcutter installed (even if you also had a newer
version without this problem), Rubygems would activate gemcutter 0.5 and json_pure <latest>.
If your Gemfile(5) also contained json_pure (or a gem with a dependency on json_pure), the latest version on your system might conflict
with the version in your Gemfile(5), or the snapshot version in your Gemfile.lock.
If this happens, bundler will say:
You have already activated json_pure 1.4.6 but your Gemfile
requires json_pure 1.4.3. Consider using bundle exec.
In this situation, you almost certainly want to remove the underlying gem with the problematic gem plugin. In general, the authors of these
plugins (in this case, the gemcutter gem) have released newer versions that are more careful in their plugins.
You can find a list of all the gems containing gem plugins by running
ruby -rubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest version of each gem plugin, and also remove all gem plugins that you aren't using
(gem uninstall gem_name).
March 2013 BUNDLE-EXEC(1)