Sponsored Content
Top Forums Shell Programming and Scripting Grep values on alternate lines Post 302831623 by sam05121988 on Thursday 11th of July 2013 10:19:14 AM
Old 07-11-2013
Lightbulb Grep values on alternate lines

Hi,

I have a file like

Code:
2011|ACC|.*
2013|ACC|.*
2011|ACCC|.*
2013|ACCC|.*
2013|ACCV|.*
2011|ADB|.*
2013|ADB|.*
2011|ADBC|.*
2013|ADBC|.*
2011|AIA|.*
2013|AXJ|.*
2013|NNN|.*

.* represnts any alphanumeric characters after this part of the string

I need a code to return only the rows which has same value on the second field but different value on first


for eg:
for above piece of data, code should return

Code:
2011|ACC|.*
2013|ACC|.*
2011|ACCC|.*
2013|ACCC|.*
2011|ADB|.*
2013|ADB|.*
2011|ADBC|.*
2013|ADBC|.*


any suggestions ?

[OS Info : Red Hat Enterprise Linux Server release 5.3 Beta]

Thanks
Sam
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

alternate lines from two files

A basic request two files want to combine them but on alternate lines (1 Reply)
Discussion started by: SummitElse
1 Replies

2. Shell Programming and Scripting

alternate lines

Hi, I'm new to Unix. I want to read the all the lines from a text file and write the alternate lines into another file. Please give me a shell script solution. file1 ----- one two three four five six seven newfile(it should contain the alternate lines from the file1) ------- one... (6 Replies)
Discussion started by: pstanand
6 Replies

3. Shell Programming and Scripting

alternate for "grep -vf" command

I have been using grep for removing lines of a particular pattern from a long file in the following way grep -vf Exclude_Lines File1 > File2 But grep seems to have some problems because sometimes it does the job, sometimes it does not....I have seen AWK is more powerful.. Can the same thing... (5 Replies)
Discussion started by: ananyob
5 Replies

4. Shell Programming and Scripting

reading alternate lines of a file

hi, i have 2 files. file1: 1 2 3 4 5 6 file2: a b c d e f g h i (5 Replies)
Discussion started by: vidyaj
5 Replies

5. Shell Programming and Scripting

Perl XML, find matching condition and grep lines and put the lines somewhere else

Hi, my xml files looks something like this <Instance Name="New York"> <Description></Description> <Instance Name="A"> <Description></Description> <PropertyValue Key="false" Name="Building A" /> </Instance> <Instance Name="B"> ... (4 Replies)
Discussion started by: tententen
4 Replies

6. Shell Programming and Scripting

Insert string in alternate lines

Hi All, In continuation of my previous thread 'Add text at the end of line conditionally', I need to further modfiy the file after adding text at the end of the line. Now, I need to add a fixed charater string at alternate lines starting from first line using awk or sed.My file is now as below:... (10 Replies)
Discussion started by: angshuman
10 Replies

7. Shell Programming and Scripting

Grep values from different lines

Hello, I have a log file with many lines and I want to grep pcific values from spcific lines, I'm not sure if it is possible or not Sample 16-11-11 19:54:13:INFO:Connection to device ip 20.10.11.23 took 0 16-11-11 19:54:13:FINE:Sending request. 16-11-11 19:54:13:INFO:Received response from... (3 Replies)
Discussion started by: roby2411
3 Replies

8. Programming

Perl : joining alternate lines

Hi, I need to join every alternate line in a file for eg:input file $ cat abc abc def ghi jkloutput abc def ghi jklcode i wrote for this $ cat add_line.pl #!/usr/bin/perl -w my $count=1; #my $line=undef; my @mem_line; my $i=0; my $x=0; (2 Replies)
Discussion started by: sam05121988
2 Replies

9. Shell Programming and Scripting

Process alternate lines in awk/sed/perl

hi.. i have a fasta file with the following format >sequence1 CCGGTTTTCGATTTGGTTTGACT >sequence2 AAAGTGCCGCCAGGTTTTGAGTGT >sequence3 AGTGCCGCAGAGTTTGTAGTGT Now, i want to read alternate line and add "GGGGGGGGGGG" to end of every sequence Desired output: >sequence1... (4 Replies)
Discussion started by: empyrean
4 Replies

10. Shell Programming and Scripting

Comparing alternate lines of code

Hi gents, Have only a passing familiarity with linux/shell at this point, so please forgive simple question. I have text files that have lines something like the following: a b c d d d e f e f e f a b (6 Replies)
Discussion started by: cabled
6 Replies
ADB(4)							   BSD Kernel Interfaces Manual 						    ADB(4)

NAME
adb -- Apple Desktop Bus driver SYNOPSIS
adb* at obio? options MRG_ADB #include <machine/adbsys.h> DESCRIPTION
The Apple Desktop Bus (ADB) is the single-master, multiple-slave, low-speed serial bus interface used by Macintosh computers to connect input devices such as keyboards, mice, trackpads, trackballs, and graphics tablets to the machine. NetBSD provides support for the Apple Desktop Bus as found on all supported mac68k models, as well as macppc models with on-board ADB (PowerBooks and ``Old World'' models). The adb driver accesses the ADB controller using the so-called ``HWDIRECT'' method. This method of access bypasses the Macintosh ROM and uses only NetBSD routines for ADB access. This is the only method supported on macppc and is the default for mac68k systems. On mac68k systems there is an alternate method of accessing the ADB controller. With the Macintosh ROM Glue (MRG) method, the routines writ- ten for MacOS are used. To enable this method of ADB access, uncomment the line: options MRG_ADB in your kernel configuration file. The ioctl(2) call is used to control the ADB event device. The following is a list of available ioctl(2) commands: ADBIOC_DEVSINFO Get ADB Device Info The adb event device will return an array of information containing an entry for each device connected to the bus. Each entry contains the current address, default address, and handler ID for the corresponding ADB device. ADBIOC_GETREPEAT Get Keyboard Repeat Info Returns a structure containing the current keyboard repeat delay and keyboard repeat interval. ADBIOC_SETREPEAT Set Keyboard Repeat Rate Sets the keyboard repeat delay and interval to the values specified by argp. ADBIOC_RESET ADB Reset Perform a reset of the ADB which will reinitialize all of the devices attached to the bus. ADBIOC_LISTENCMD ADB Listen Command Send data to the register of the ADB device specified by argp. This command is not fully implemented at this time. SUPPORTED DEVICES
NetBSD includes support for the following ADB devices, sorted by driver name: abtn ADB mouse button? aed ADB event device akbd ADB keyboard ams ADB mouse apm APM emulation FILES
/dev/adb The ADB event device. DIAGNOSTICS
aed0 at adb0 addr 0: ADB Event device This is a normal autoconfiguration message noting the presence of the adb event device. adb0 at obio0 offset 0x16000 irq 18: 2 targets A standard autoconfiguration message indicating the initialization of the ADB subsystem. adb: no devices found. No ADB devices were found to be connected to the bus during autoconfiguration. adb: using %s series hardware support. Indicates the class of ADB hardware support the machine uses. adb: hardware type unknown for this machine. The ADB hardware in this machine is currently unsupported. adb: no ROM ADB driver in this kernel for this machine. The kernel lacks the necessary Macintosh ROM Glue (MRG) support for accessing the ADB hardware on this machine. adb: using serial console. A serial console will be used for user input rather than the ADB event device. adb: %s at %d. An ADB device of the type specified by %s has been found at location %d. SEE ALSO
aed(4), akbd(4), ams(4), apm(4) HISTORY
The adb interface first appeared in NetBSD 0.9. It has been under development ever since. AUTHORS
Bradley A. Grantham wrote the original adb driver, including the MRG support. The hardware direct interface was written by John P. Wit- tkowski. The PowerManager interface was written by Takashi Hamada. BUGS
o Not every class of ADB hardware is supported yet. o The talk command is currently unimplemented. o The listen command is not implemented yet. o Not all multi-button mice are currently supported. o Only mapped and relative-position ADB devices (i.e. keyboards and mice) are supported. Thus absolute-position and other exotic devices will not work. o Some of the diagnostic messages in this man page need to be updated. Some mac68k machines contain so-called dirty ROM. These machines are the: Mac SE/30, Mac II, Mac IIx, and Mac IIcx. Machines with dirty ROM may experience trouble booting if the MRG code is used, especially under the following conditions: o Both a keyboard and a mouse are not attached to the computer. o An extended keyboard is attached to the computer. On (some) machines with dirty ROM, the ROM indicates the presence of a ``ghost'' keyboard or mouse. When this non-existant device is probed for, the result is an infinite loop. This is believed to be triggered by the adb driver probing for extended mice, and non-EMP Logitech mice. BSD
September 21, 2003 BSD
All times are GMT -4. The time now is 01:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy