09-20-2014
How to use variable as separator in awk?
can some give me a example ?
eg:
a=usb
I want to use variable "a" as separator
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a variable A
echo $A
5060
I am exporting the value X,Y,Z and it id fetching right thing and When I run
C=`${X} -l ${Y} ${Z} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; netstat -na | grep \$A`
echo $C
shows extra lines which is present in the directory with grep A value... (0 Replies)
Discussion started by: madhusmita
0 Replies
2. Shell Programming and Scripting
Hi
I have a file which looks like this
#HEllo
#How....
#version 1.0.1
#Author aaaaa
ab.-.1.-.90.-.80.-..-.OK
cd.-.8.-.91.-.800.-.xy.-..-.
the separator is .-. (dot hyphen dot)
I want to display this as columns like
ab cd
1 8
90 91 (1 Reply)
Discussion started by: PrasannaKS
1 Replies
3. UNIX for Dummies Questions & Answers
Hi Friends,
Scripting newb here. So I'm trying to create a geektool script that uses awk and printf to output certain fields from top (namely command, cpu%, rsize, pid and time, in that order).
Here's the input from the top process that I'm putting into awk:
PID COMMAND %CPU ... (3 Replies)
Discussion started by: thom.mattson
3 Replies
4. Shell Programming and Scripting
Hi
I need to check if field separator I am using in awk statement is " : ", for example:
TIME=12:59
HOUR=`echo "$TIME" | awk '{FS=":"; print $1}'`
MINUTES=`echo "$TIME" | awk '{FS=":"; print $2}'`
Is there a way to check within the above awk statement ?
Thanks for help -A (2 Replies)
Discussion started by: aoussenko
2 Replies
5. UNIX for Dummies Questions & Answers
In awk, how do I print all fields with a specified output field separator?
I have tried the following, which does not print the output FS:
echo a b c d | awk 'BEGIN{OFS = ";"}{print $0}' (3 Replies)
Discussion started by: locoroco
3 Replies
6. Shell Programming and Scripting
I need to set awk field separator to ";", but I need to avoid ";EXT".
so that
echo a;b;c;EXTd;e;f | awk -F";" '{print $3}'
would give "c;EXTd" (2 Replies)
Discussion started by: locoroco
2 Replies
7. Shell Programming and Scripting
Hi Experts ,
file :
- How to construct the awk filed separator so that $1, $2 $3 , can be assigned to the each "" range.
I am trying : awk -F"]" '{print $1}'
but it is printing the entire file. Not first field.
The desired output needed for first field... (9 Replies)
Discussion started by: rveri
9 Replies
8. Shell Programming and Scripting
I can not figure out how to set the Output filed separator in awk when using printf.
Example:
cat file
some data
here_is_more information
Requested output
some------------data
her_is_more-----information
Here are some that does not work:
awk '{printf "%-15s %s\n",$1,$2}' OFS="-" file... (9 Replies)
Discussion started by: Jotne
9 Replies
9. Shell Programming and Scripting
Hello to all,
Please some help on this. I have the file in format as below.
How can I set the record separator as the string below in red
"No. Time Source Destination Protocol Length Info"
I've tried code below but it doesn't seem to... (6 Replies)
Discussion started by: cgkmal
6 Replies
10. Shell Programming and Scripting
Friends have the following code that is correct.
BEGIN { num_reg = 0
suma_iva=0
}
{
num_reg++
suma_iva=suma_iva+int(substr($0, 103,9))
}
END{
printf ("%011d",suma_iva)
}
I have the following problem, I have to do just that but this time... (4 Replies)
Discussion started by: tricampeon81
4 Replies
LEARN ABOUT NETBSD
sane-hp4200
sane-hp4200(5) SANE Scanner Access Now Easy sane-hp4200(5)
NAME
sane-hp4200 - SANE backend for Hewlett-Packard 4200 scanners
DESCRIPTION
The sane-hp4200 library implements a SANE (Scanner Access Now Easy) backend that provides access to the following Hewlett-Packard USB
flatbed scanners:
ScanJet 4200 C
ScanJet 4200 Cxi
ScanJet 4200 Cse
More details can be found on the hp4200 backend homepage http://hp4200-backend.sourceforge.net/.
This is BETA software. Keep your hand at the scanner's plug and unplug it, if the head bumps at the end of the scan area.
If you own a scanner other than the ones listed above that works with this backend, please let us know this by sending the scanner's exact
model name and the USB vendor and device ids (e.g. from /proc/bus/usb/devices, sane-find-scanner or syslog) to us. Even if the scanner's
name is only slightly different from the models mentioned above, please let us know.
CONFIGURATION
The contents of the hp4200.conf file is a list of usb lines containing vendor and product ids that correspond to USB scanners. The file can
also contain the names of device files that correspond to an HP 4200 scanner. Empty lines and lines starting with a hash mark (#) are
ignored. The scanners are autodetected by usb vendor_id product_id statements which are already included into hp4200.conf. "vendor_id"
and "product_id" are hexadecimal numbers that identify the scanner. If autodetection does not work, add the device name of your scanner to
the configuration file, e.g. /dev/usb/scanner0.
FILES
/etc/sane.d/hp4200.conf
The backend configuration file (see also description of SANE_CONFIG_DIR below).
/usr/lib64/sane/libsane-hp4200.a
The static library implementing this backend.
/usr/lib64/sane/libsane-hp4200.so
The shared library implementing this backend (present on systems that support dynamic loading).
ENVIRONMENT
SANE_CONFIG_DIR
This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories
are separated by a colon (`:'), under OS/2, they are separated by a semi-colon (`;'). If this variable is not set, the configura-
tion file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. If the value
of the environment variable ends with the directory separator character, then the default directories are searched after the explic-
itly specified directories. For example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories "tmp/config", ".",
and "/etc/sane.d" being searched (in this order).
SANE_DEBUG_HP4200
If the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. Higher
debug levels increase the verbosity of the output.
Example: export SANE_DEBUG_HP4200=4
SEE ALSO
sane(7), sane-usb(5),
http://hp4200-backend.sourceforge.net/
AUTHOR
Adrian Perez Jorge, Andrew John Lewis, Arnar Mar Hrafnkelsson, Frank Zago, Henning Meier-Geinitz. Current maintainer: Henning Meier-Geinitz
<henning@meier-geinitz.de>.
BUGS
Tested only with Linux.
Only 8 bit color mode works.
Scanning is slow due to backtracking.
Send bug reports to the sane-devel mailing list: sane-devel@lists.alioth.debian.org.
13 Jul 2008 sane-hp4200(5)