Getting required fields from a text file in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting required fields from a text file in UNIX
# 8  
Old 07-01-2009
Oops. Use tmp[2], not tmp[1]. I corrected the post.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to search a text in file and retrieve required lines following it with UNIX command?

I have requirement to search for a text in the file and retrieve required lines that is user defined with unix command. Eg: Find the text UNIX in the below file and need to return Test 8 & Test 9 Test 1 Test 2 Test 3 Test 4 UNIX Test 5 Test 6 Test 7 Test 8 Test 9 Result can... (8 Replies)
Discussion started by: Arunkumarsak4
8 Replies

2. Shell Programming and Scripting

Rearrange fields of delimited text file

I want to rearrange the fields of delimited text file after sorting first line (only): input file: a_13;a_2;a_1;a_10 13;2;1;10 the result should be: a_1;a_2;a_10;a_13 1;2;10;13 any help would be appreciated andy (20 Replies)
Discussion started by: andy2000
20 Replies

3. Shell Programming and Scripting

How to identify varying unique fields values from a text file in UNIX?

Hi, I have a huge unsorted text file. We wanted to identify the unique field values in a line and consider those fields as a primary key for a table in upstream system. Basically, the process or script should fetch the values from each line that are unique compared to the rest of the lines in... (13 Replies)
Discussion started by: manikandan23
13 Replies

4. Shell Programming and Scripting

How to Modify a file content in UNIX and sort for only required fields ?

I have the below contents in a file after making the below curl call curl ... | grep -E "state|Rno" | paste -sd',\n' | grep "Disconnected" > test "state" : "Disconnected",, "Rno" : "5554f1d2" "state" : "Disconnected",, "Rno" : "10587563" "state" : "Disconnected",, "Rno" :... (2 Replies)
Discussion started by: Vaibhav H
2 Replies

5. Shell Programming and Scripting

Parse file for fields and specific text

I have a file of ~500,000 entries in the following: file.txt chr1 11868 12227 ENSG00000223972.5 . + HAVANA exon . gene_id "ENSG00000223972.5"; transcript_id "ENST00000456328.2"; gene_type "transcribed_unprocessed_pseudogene"; gene_status "KNOWN"; gene_name "DDX11L1"; transcript_type... (17 Replies)
Discussion started by: cmccabe
17 Replies

6. Shell Programming and Scripting

How to search for blank fields in a text file from a certain position?

Sample txt file : OK00001111112| OK00003443434|skjdaskldj OK32812983918|asidisoado OK00000000001| ZM02910291029|sldkjaslkjdasldjk what would be the shell script to figure out the blank space (if any) after the pipe sign? (4 Replies)
Discussion started by: chatwithsaurav
4 Replies

7. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

8. Shell Programming and Scripting

how to convert fields from a text file to excel columns

i have this file which has the following contents: ,-0.3000 ,-0.3000 ,-0.3000 ,-0.9000 ,-0.9000 ,-0.9000 i would like to get this: -0.3-0.9-0.3-0.9-0.3-0.9 so far i am trying: awk '{for(i=1; i<=NF; i++) {printf("%f\n",$i)}}' test1 > test2 any help... (4 Replies)
Discussion started by: npatwardhan
4 Replies

9. UNIX for Dummies Questions & Answers

extract fields from text file using delimiter!!

Hi All, I am new to unix scripting, please help me in solving this assignment.. I have a scenario, as follows: 1. i have a text file(read1.txt) with the following data sairam,123 kamal,122 etc.. 2. I have to write a unix... (6 Replies)
Discussion started by: G.K.K
6 Replies

10. Shell Programming and Scripting

Need a Help with sort a text file with some fields

Ive got a file called listacdrs with this structure: 01/09/2006 12:13 p.m. 1.046.528 CF0155.DAT 01/09/2006 12:13 p.m. 1.046.528 CF0156.DAT 01/09/2006 12:13 p.m. 1.046.528 CF0157.DAT 01/09/2006 12:13 p.m. 1.046.528 CF0158.DAT 01/09/2006 12:14 p.m. ... (3 Replies)
Discussion started by: alexcol
3 Replies
Login or Register to Ask a Question
aoeping(8)						      System Manager's Manual							aoeping(8)

NAME
aoeping - simple communication with AoE device SYNOPSIS
aoeping [options] {shelf} {slot} {netif} DESCRIPTION
The aoeping(8) program performs simple one or two-round-trip communication with an ATA over Ethernet (AoE) device. It creates and receives AoE packets directly, using raw network sockets. Running aoeping(8) without command line arguments will result in a short usage summary being displayed. The aoeping(8) program will wait forever if it doesn't receive an expected response. The caller should use a time out to catch this situa- tion. Arguments shelf This should be the shelf address (major AoE address) of the AoE device to communicate with. slot This should be the slot address (minor AoE address) of the AoE device to communicate with. netif The name of the ethernet network interface to use for AoE communications, e.g., eth1. Options -i Issue an ATA "identify device" command after receiving the AoE device's Config Query response. The "ident" response will be printed on standard output as a hexidecimal dump. -I Issue an ATA "identify device" command after receiving the AoE device's Config Query response. The "ident" response will be pretty- printed on standard output as selected human-readable fields. -v Turn on more copious output, including a hexidecimal dump of the Config Query response from the AoE device (see AoE spec at URL below). -s This option takes an argument. The argument is a decimal integer that specifies the number of seconds that aoeping(8) will wait for a response before timing out and exiting with a non-zero status. -S This option takes an argument. The argument is the name of a SMART command to send to the disk. The SMART commands in the list below are supported. If the command requires data transfer, one sector (512 bytes) of data is always the amount transfered. If the command takes a parameter (for the Low LBA register), then the name of the SMART command is immediately followed by a colon and then a number, the value of the parameter, e.g., "-S read_log:1". read_data offline_immediate read_log write_log enable disable return_status For write_log, aoeping(8) reads from standard input the one sector of data to be written to the specified log. If the AoE device does not support SMART commands or if the command is aborted, an error message is printed to standard error and aoeping(8) exits with a non-zero status. A command may be aborted if SMART is disabled on the device. The aoeping(8) command just sends and receives SMART commands, without interpreting them. See the ATA specification for more infor- mation on using SMART. -t (This is an advanced feature.) This option has an argument. The argument is a decimal integer that is used as the initial tag, with the highest bit set, as the first tag in ATA commands. Tags for subsequent ATA commands will be incremented by one. -h Show a usage summary. EXAMPLE
In this example, the root user uses aoeping(8) to check for the presence of aoe device e10.9 on network interface eth0. bash# aoeping -v 10 9 eth0 | head tag: 80000000 eth: eth0 shelf: 10 slot: 9 config query response: 00 0d 87 aa c9 00 00 10 04 00 11 1f 88 a2 18 00 00 0a 09 01 00 00 00 00 00 03 30 08 00 10 00 04 66 6f 6f 0a 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff The next example shows root making sure the disk on the e10.9 is still responsive by issuing an ATA device identify command with a 20-sec- ond timeout. bash# aoeping -i -s 20 10 9 eth0 > /dev/null && echo ok ok The next example uses SMART to determine whether the disk on e10.9 thinks it has exceeded its error threshold. The ATA spec says that the LBA Mid register will be 0x4f when the disk has not exceeded its error threshold. bash# aoeping -S return_status 10 9 eth0 | grep 'LBA Mid: 0x4f' > /dev/null && echo ok ok Note that in a script, it would be prudent to specify and handle a timeout. Also, a good script would make sure the Status register does not have the error bit (bit zero) or the device fault bit (bit 5) set. SEE ALSO
aoe-discover(8), aoe-interfaces(8), aoe-mkdevs(8), aoe-mkshelf(8), aoe-stat(8), AoE (ATA over Ethernet): http://support.coraid.com/documents/AoEr10.txt, ATA specification AUTHOR
Ed L. Cashin (ecashin@coraid.com) aoeping(8)