I had a small question.I had a file from which i need to extract data.
I have written the below script to check if the file exists and if it exists extract requierd columns from the file.
From above out of 13 columns i am extracting 5 column and their values.
Now how i can accomodate a condition in above script so that it check if $13(13 column) is null it should throw an error and send out an email like error in file format.
Hi All,
I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Hi All,
I have a file with 10 columns and get the required data for nine columns properly except 8th. In 8th column i have both NULL and NON NULL values...i.e
certain records have values for all the columns including 8th column and certain records have 8th column as NULL.My requisite is,without... (20 Replies)
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Hi Gurus,
I have a tab separated text file with two columns. I would like to make the first column values as headings for the second column values.
Ex.
>value1 subjects
>value2 priorities
>value3 requirements
...etc
and I want to have a file
>value1
subjects
>value2
priorities... (4 Replies)
Hello experts,
I have a requirement where I have to implement two checks on a csv file:
1. Check to see if the value in first column is duplicate, if any value is duplicate script should exit.
2. Check to verify if the value at second column is between "yes" or "no", if it is anything else... (4 Replies)
Hi Guys,
I am new to shell script.I need your help to write a shell script.
I have a csv file which has 13 columns separated by ,
I have written below script to fetch required 5 columns.
awk -F, '(NR==1){h3=$3;h4=$4;h8=$8;h9=$9;h13=$13;next}(NF>1) \
{print... (5 Replies)
Gents,
I have a file where i would like to check the constant increment by 2 in column 2.
5450 1000
5450 1002
5450 1004
5450 1006
5465 1000
5465 1002
5465 1006
5465 1008
5550 1002
5550 1004
5550 1006
5550 1008
6830 1000
6830 1002
6830 1008
6830 1010 (6 Replies)
Hi,
I have a requirement where I have to check whether the mandatory columns in a pipe delimited file is null and print error message.
For eg, I have to check if the 3rd,5th,6th,7th and 8th column are null and print the message "<column name> is null".
The data file will have aroung 100,000... (6 Replies)
Hi Folks,
I'm trying to write a simple file sanity check script. I have a directory with dozen CSV files containing id,edname,firstname,lastname,suffix,email.
I like to write a awk script to check if first field contain a number and is not empty. and fields number 3,4 & 6 are not empty and... (3 Replies)
Discussion started by: dc34684
3 Replies
LEARN ABOUT SUSE
sg_raw
SG_RAW(8) SG3_UTILS SG_RAW(8)NAME
sg_raw - sends an arbitrary SCSI command (with an optional data phase) to a device
SYNOPSIS
sg_raw [OPTIONS] DEVICE CDB0 CDB1 ...
DESCRIPTION
This utility sends an arbitrary SCSI command (between 6 and 16 bytes) to the DEVICE. For the optional data phase, data can either be read
from a file and sent to the DEVICE or received from the DEVICE and then displayed or written to a file.
The SCSI command may be between 6 and 16 bytes long. Each command byte is specified in plain hex format (00..FF) without a prefix or suf-
fix. See EXAMPLES section below.
The commands pass through a generic SCSI interface which is implemented for several operating systems including Linux, FreeBSD and Windows.
OPTIONS
Arguments to long options are mandatory for short options as well.
-b, --binary
Dump data in binary form, even when writing to stdout.
-h, --help
Display usage information and exit.
-i, --infile=IFILE
Read data from IFILE instead of stdin. This option is ignored if --send is not specified.
-k, --skip=LEN
Skip the first LEN bytes of the input file or stream. This option is ignored if --send is not specified.
-n, --nosense
Don't display SCSI Sense information.
-o, --outfile=OFILE
Write data received from the DEVICE to OFILE. The data is written in binary. By default, data is dumped in hex format to stdout. If
OFILE is '-' then data is dumped in binary to stdout. This option is ignored if --request is not specified.
-r, --request=RLEN
Expect to receive up to RLEN bytes of data from the DEVICE. RLEN may be suffixed with 'k' to use kilobytes (1024 bytes) instead of
bytes. This option and --send are mutually exclusive.
-s, --send=SLEN
Read SLEN bytes of data, either from stdin or from a file, and send them to the DEVICE. This option and --request are mutually
exclusive.
-t, --timeout=SEC
Wait up to SEC seconds for command completion (default: 20). Note that if a command times out the operating system may start by
aborting the command and if that is unsuccessful it may attempt to reset the device.
-v, --verbose
Increase level of verbosity. Can be used multiple times.
-V, --version
Display version and license information and exit.
EXAMPLES
sg_raw /dev/scd0 1b 00 00 00 02 00
Eject the medium in CD drive /dev/scd0.
sg_raw -r 1k /dev/sg0 12 00 00 00 60 00
Perform an INQUIRY on /dev/sg0 and dump the response data (up to 1024 bytes) to stdout.
sg_raw -s 512 -i i512.bin /dev/sda 3b 02 00 00 00 00 00 02 00 00
Showing an example of writing 512 bytes to a sector on a disk is a little dangerous. Instead this example will read i512.bin
(assumed to be 512 bytes long) and use the SCSI WRITE BUFFER command to send it to the "data" buffer (that is mode 2). This is a
safe operation.
sg_raw -r 512 -o o512.bin /dev/sda 3c 02 00 00 00 00 00 02 00 00
This will use the SCSI READ BUFFER command to read 512 bytes from the "data" buffer (i.e. mode 2) then write it to the o512.bin
file. When used in conjunction with the previous example, if both commands work then 'cmp i512.bin o512.bin' should show a match.
EXIT STATUS
The exit status of sg_raw is 0 when it is successful. Otherwise see the sg3_utils(8) man page.
AUTHOR
Written by Ingo van Lil
REPORTING BUGS
Report bugs to <inguin at gmx dot de>.
COPYRIGHT
Copyright (C) 2001-2008 Ingo van Lil
This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
POSE.
SEE ALSO
sg_opcodes sg_vpd(sg3_utils), hdparm(hdparm), sgdiag(scsirastools)
sg3_utils-1.26 May 2008 SG_RAW(8)