08-07-2013
Grep or print each section of a file on one line with a separator
I can obtain information from itdt inventory command however it display as below, I'd like to print each entity on one line but seperated by :
the file is something like and each section ends with Volume Tag
Drive Address 256
Drive State ................... Normal
ASC/ASCQ ...................... 0000
Media Present ................. No
Robot Access Allowed .......... Yes
Source Element Address Valid .. No
Accessor Preferred Zone........ A (TS3500 only)
Media Inverted ................ No
Same Bus as Medium Changer .... Yes
SCSI Bus Address Valid ........ No
Logical Unit Number Valid ..... No
Volume Tag ....................
...
I would like the output to display something like
Drive Address 256
rive State Normal:Media Present Yes:and so on
Drive Address 257
rive State Normal:Media Present Yes: and so on
...
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi,
I have a 20 line file.
I need a command which will brinf back a specific line based upon the line number I enter.
e.g. the file looks like this and is called file1
jim is a man
john is a woman
james is a man
wendy is a woman
lesley is a woman
i want a command that will... (4 Replies)
Discussion started by: sureshy
4 Replies
2. Shell Programming and Scripting
I'm having problems since few days ago, and i'm not able to make it works with a simple awk+grep script (or other way to do this).
For example, i have a input file1.txt:
cat inputfile1.txt
218299910417
1172051195
1172070231
1172073514
1183135117
1183135118
1183135119
1281440202
... (3 Replies)
Discussion started by: poliver
3 Replies
3. Shell Programming and Scripting
I have a list of Servers in no particular order as follows:
virtualMachines="IIBSBS IIBVICDMS01 IIBVICMA01"And I am generating some output from a pre-existing script that gives me the following (this is a sample output selection).
9/17/2010 8:00:05 PM: Normal backup using VDRBACKUPS... (2 Replies)
Discussion started by: jelloir
2 Replies
4. Shell Programming and Scripting
I have searched in a variety of ways in a variety of places but have come up empty.
I would like to prepend a portion of a section header to each following line until the next section header. I have been using sed for most things up until now but I'd go for a solution in just about anything--... (7 Replies)
Discussion started by: pagrus
7 Replies
5. Shell Programming and Scripting
Hi,
i have a file like this:
...
11111111
22222222
33333333
#
4444444
5555555
6666666
7777777
#
...
i want just print the 2 first line between each section (each section is separated with "#"). so desired output would be like this:
...
11111111
22222222 (3 Replies)
Discussion started by: saeed.soltani
3 Replies
6. Shell Programming and Scripting
hi
# cat test.txt
Test
Date: 20131008 1515
--------------------------------------------------------------------------------------------------------------
Saxx = Proc_m0_s13 : 1640
Saxx = Proc_m0_s15 : 1791
Saxx = Proc_m0_s17 ... (2 Replies)
Discussion started by: justbow
2 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I have some large files which I would like to obtain some data from, I want to grep (or alturnative method) out certain values hut only if the folowing line doesnt contain a certain value. I will explain better below showing an example print of the data.
NE : V0001
NE : V0002... (6 Replies)
Discussion started by: mutley2202
6 Replies
8. Shell Programming and Scripting
Hi Guys,
I have the file
---
HOST_NAME,data_coleta,data_carga,CPU_util,CPU_idle,run_queue,memory,MEMORY_SYSTEM,MEMORY_TOTAL,MEMORY_SWAPIN,MEMORY_SWAPOUT,DISK_READ,DISK_WRITE,DISK_IO,NET_IN_PACKET,
NET_OUT_PACKET... (4 Replies)
Discussion started by: antoniorajr
4 Replies
9. UNIX for Beginners Questions & Answers
Hello,
I have a log file that has several sections "BEGIN JOB, End of job" like in the following example:
19/06/12 - 16:00:57 (27787398-449294): BEGIN JOB j1(27787398-449294) JOB1
19/06/12 - 16:00:57 (27787398-449294): DIGIT: 0
number of present logs : 1
19/06/12 - 16:00:57... (4 Replies)
Discussion started by: mvalonso
4 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have below file which has different sections, need to move the sections to beginning of the each record.
original file
aaa
bbb
ccc
ddd
eee
fff
output file.
aaa
bbb
ccc
ddd
eee
fff (6 Replies)
Discussion started by: green_k
6 Replies
dump(1) User Commands dump(1)
NAME
dump - dump selected parts of an object file
SYNOPSIS
dump [-aCcfghLorstV [-p]] [ -T index [ , indexn]] filename...
dump [ -afhorstL [-p] [v]] filename...
dump [ -hsr [-p] [ -d number [ , numbern]]] filename...
dump [ -hsrt [-p] [-n name]] filename...
DESCRIPTION
The dump utility dumps selected parts of each of its object file arguments.
The dump utility is best suited for use in shell scripts, whereas the elfdump(1) command is recommended for more human-readable output.
OPTIONS
This utility will accept both object files and archives of object files. It processes each file argument according to one or more of the
following options:
-a Dumps the archive header of each member of an archive.
-c Dumps the string table(s).
-C Dumps decoded C++ symbol table names.
-f Dumps each file header.
-g Dumps the global symbols in the symbol table of an archive.
-h Dumps the section headers.
-L Dumps dynamic linking information and static shared library information, if available.
-o Dumps each program execution header.
-r Dumps relocation information.
-s Dumps section contents in hexadecimal.
-t Dumps symbol table entries.
-T index Dumps only the indexed symbol table entry defined by index or a range of entries defined by index1,index2.
-T index1,index2
-V Prints version information.
The following modifiers are used in conjunction with the options listed above to modify their capabilities.
-d number Dumps the section number indicated by number or the range of sections starting at number1 and ending at number2.
-d number1,number2 This modifier can be used with -h, -s, and -r. When -d is used with -h or -s, the argument is treated as the number
of a section or range of sections. When -d is used with -r, the argument is treated as the number of the section or
range of sections to which the relocation applies. For example, to print out all relocation entries associated with
the .text section, specify the number of the section as the argument to -d. If .text is section number 2 in the
file, dump -r -d 2 will print all associated entries. To print out a specific relocation section, use dump -s -n
name for raw data output, or dump -sv -n name for interpreted output.
-n name Dumps information pertaining only to the named entity. This modifier can be used with -h, -s, -r, and -t. When -n
is used with -h or -s, the argument will be treated as the name of a section. When -n is used with -t or -r, the
argument will be treated as the name of a symbol. For example, dump -t -n .text will dump the symbol table entry
associated with the symbol whose name is .text, where dump -h -n .text will dump the section header information
for the .text section.
-p Suppresses printing of the headings.
-v Dumps information in symbolic representation rather than numeric. This modifier can be used with
-a (date, user id, group id)
-f (class, data, type, machine, version, flags)
-h (type, flags)
-L (value)
-o (type, flags)
-r (name, type)
-s (interpret section contents wherever possible)
-t (type, bind)
When -v is used with -s, all sections that can be interpreted, such as the string table or symbol table, will be
interpreted. For example, dump -sv -n .symtab filename... will produce the same formatted output as dump -tv file-
name..., but dump -s -n .symtab filename... will print raw data in hexadecimal. Without additional modifiers, dump
-sv filename... will dump all sections in the files, interpreting all those that it can and dumping the rest (such
as .text or .data) as raw data.
The dump utility attempts to format the information it dumps in a meaningful way, printing certain information in character, hexadecimal,
octal, or decimal representation as appropriate.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWbtool |
+-----------------------------+-----------------------------+
SEE ALSO
elfdump(1), nm(1), ar.h(3HEAD), a.out(4), attributes(5)
SunOS 5.10 6 Sep 2002 dump(1)