it's a not 'awk' introducing an issue here - it's the surrounding 'for' loop parsing the output from 'awk'.
The 'for' loop iterates through through the list (specified in the 'in' clause) using the InternalFieldSeparator (aka IFS). By default the IFS is set to space, tab and new-line.
Your awk produces lines with the embedded spaces 'Probe Name' and 'Probe Temp'. The 'for' loop treats those embedded space and field separators - therefore you get new lines with your 'echo'.
You can either change your awk removing the embedded spaces from its output like so 'Probe Name' -> 'ProbeName' and leave the rest of the code unchanged.
Reset the IFS to something that you wouldn't expect from awk's output. Something along these lines:
BTW, why are you printing the '\n---' in awk? Would it be more intuitive to do it in the wrapper loop AFTER the 'echo' is done?
The alternative would be to do it all in shell
Pick your poison! (as someone recently said).
I am facing a very challenging task here but can't finish it.I request all of you to help me please.
I have one file which contain some data i need to format it.
data file contain data like
54321|item-68|owner|yes||||$
00-10|invoice|3221|||#
00-11|invoice|3221|||#... (1 Reply)
Hi
Suppose we have a file consisting of nos in following format
123 - 789
123 - 828
345 - 989
345 - 792
I require the following output
123, 789,828
345, 989,792
Means Unique nos in 1st Column and Corresponding two nos in comma separated 2nd Column
Please help me out... (6 Replies)
I would like to keep the complete lines in the output, but my script adds carriage returns for each space (e.g. keep BRITISH AIRWAYS on one line in the output):
File1=
BAW
BRITISH AIRWAYS
RYR
RYAN AIR
for i in $(cat File1)
do
echo $i
done
Output:
BAW
BRITISH
AIRWAYS
RYR... (4 Replies)
I want the following output:
User ID: 4071
Last Name: Gills
First Name: Roberts
Address: Maple Dr.
Phone#: 702346789
from this command:
grep "$uId" database.txt | awk -F":" '{print "User ID:\t"$uId"\nLast Name:\t"$lname"\n...etc. }'
But all I get is this:
User ID:... (3 Replies)
Hi,
I was trying to format my number like i=1 to 000001 using the below method.
typeset -Z6 i (sorry, corrected)
My shell is K, is not doing, it is supposed to do
Thanks in advance (6 Replies)
Hello; having an annoying issue:
I wish to have the same formatting in:
awk '{print $1}' LOCAL
f30f31be17a236378ac896639cc1b996
bff4c460f601444db6ef7f6ad6ca44b9
347a399b6fe9c2f21e6a7f55911c1483
ce3f8fdd4919e891090ca27872f4f983
c00098663f064d14065d0ef248a4db44... (2 Replies)
Hi,
I was trying to dos2unix a file that has some special characters but dos2unix converted those into different format. I am working on sun server.
I guess the default for dos2unix on sun server is ISO format .
Can i change the format so that it does the conversion in UTF format?
Because I... (3 Replies)
Hello;
I have a simple loop filtering a log:
for LU in $(< LU-list-Final)
do
OUT=$(grep -B1 $LU cibc-src-ip.cap |egrep 'IP 16|IP 19|IP 15' |awk -F">" '{print $1}')
if ; then
echo " LU $LU was accessed by ===============> $OUT "
echo ""
fi
done
The current output snippet looks like... (2 Replies)
Probe::Perl(3pm) User Contributed Perl Documentation Probe::Perl(3pm)NAME
Probe::Perl - Information about the currently running perl
SYNOPSIS
use Probe::Perl;
$p = Probe::Perl->new();
# Version of this perl as a floating point number
$ver = $p->perl_version();
$ver = Probe::Perl->perl_version();
# Convert a multi-dotted string to a floating point number
$ver = $p->perl_version_to_float($ver);
$ver = Probe::Perl->perl_version_to_float($ver);
# Check if the given perl is the same as the one currently running
$bool = $p->perl_is_same($perl_path);
$bool = Probe::Perl->perl_is_same($perl_path);
# Find a path to the currently-running perl
$path = $p->find_perl_interpreter();
$path = Probe::Perl->find_perl_interpreter();
# Get @INC before run-time additions
@paths = $p->perl_inc();
@paths = Probe::Perl->perl_inc();
# Get the general type of operating system
$type = $p->os_type();
$type = Probe::Perl->os_type();
# Access Config.pm values
$val = $p->config('foo');
$val = Probe::Perl->config('foo');
$p->config('foo' => 'bar'); # Set locally
$p->config_revert('foo'); # Revert
DESCRIPTION
This module provides methods for obtaining information about the currently running perl interpreter. It originally began life as code in
the "Module::Build" project, but has been externalized here for general use.
METHODS
new()
Creates a new Probe::Perl object and returns it. Most methods in the Probe::Perl packages are available as class methods, so you don't
always need to create a new object. But if you want to create a mutable view of the "Config.pm" data, it's necessary to create an
object to store the values in.
config( $key [, $value] )
Returns the "Config.pm" value associated with $key. If $value is also specified, then the value is set to $value for this view of the
data. In this case, "config()" must be called as an object method, not a class method.
config_revert( $key )
Removes any user-assigned value in this view of the "Config.pm" data.
find_perl_interpreter( )
Returns the absolute path of this perl interpreter. This is actually sort of a tricky thing to discover sometimes - in these cases we
use "perl_is_same()" to verify.
perl_version( )
Returns the version of this perl interpreter as a perl-styled version number using "perl_version_to_float()". Uses $^V if your perl is
recent enough, otherwise uses $].
perl_version_to_float( $version )
Formats $version as a perl-styled version number like 5.008001.
perl_is_same( $perl )
Given the name of a perl interpreter, this method determines if it has the same configuration as the one represented by the current
perl instance. Usually this means it's exactly the same
perl_inc( )
Returns a list of directories in this perl's @INC path, before any entries from "use lib", $ENV{PERL5LIB}, or "-I" switches are added.
os_type( [$osname] )
Returns a generic OS type (e.g. "Unix", "Windows", "MacOS") for the given OS name. If no OS name is given it uses the value in $^O,
which is the same as $Config{osname}.
AUTHOR
Randy W. Sims <randys@thepierianspring.org>
Based partly on code from the Module::Build project, by Ken Williams <kwilliams@cpan.org> and others.
COPYRIGHT
Copyright 2005 Ken Williams and Randy Sims. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2005-04-06 Probe::Perl(3pm)