Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Finding nth line across multiple files Post 302458757 by oriqin on Friday 1st of October 2010 03:57:22 PM
Old 10-01-2010
This didn't work.

I think it's because the ">>" only appends if you have several outputs, whereas the ">" replaces if you have several outputs.
The awk command you posted (and the other commands I have) only produce one output even when it spans across several files.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding nth occurrence in line and replacing it

Hi, I have several files with data that have to be imported to a database. These files contain records with separator characters. Some records are corrupt (2 separators are missing) and I need to correct them prior to importing them into the db. Example: ... (5 Replies)
Discussion started by: stresing
5 Replies

2. UNIX for Dummies Questions & Answers

Finding Names in multiple files

What's the best way to see if a common name exists in two separate files? (3 Replies)
Discussion started by: Rally_Point
3 Replies

3. UNIX for Dummies Questions & Answers

Finding names in multiple files - second attempt

I couldn't find the original thread that I created and since I didn't get a definitive answer, I figured I'd try again. Maybe this time I can describe what I want a little better. I've got two files, each with thousands of names all separated by new line. I want to know if 'name in file1'... (2 Replies)
Discussion started by: Rally_Point
2 Replies

4. Shell Programming and Scripting

multiple regex finding in files

Hello folks, I have a text file aa.txt that contains below text (\')|(\-\-) ((\%3D)|(=)) 20%0d% i want to search each line pattern in /opt/1.log and /opt/2.log. Can some one suggest (1 Reply)
Discussion started by: learnbash
1 Replies

5. Shell Programming and Scripting

extract nth line of all files and print in output file on separate lines.

Hello UNIX experts, I have 124 text files in a directory. I want to extract the 45678th line of all the files sequentialy by file names. The extracted lines should be printed in the output file on seperate lines. e.g. The input Files are one.txt, two.txt, three.txt, four.txt The cat of four... (1 Reply)
Discussion started by: yogeshkumkar
1 Replies

6. Shell Programming and Scripting

finding multiple files using find command

I am trying to search for 2 files using the find command as below find -name file1.txt -a -name file2.txt It doesn't give a result although the files exist in the folder, however when i try the following find -name file1.txt -o -name file2.txt It does give me the result. ./file2.txt... (4 Replies)
Discussion started by: vivek_damodaran
4 Replies

7. UNIX for Dummies Questions & Answers

finding the nth match

I have a file that has information for a person....each person gets 3 or more lines to describe them. I was hoping to match person 1, then person 2.....BUT I do not know how to tell grep I only want the first (2nd, 3rd or nth) match. The alternative is doing line by line logic, which is fine... (8 Replies)
Discussion started by: countryStyle
8 Replies

8. Shell Programming and Scripting

Finding Nth Column

Please help me how can I display every nth field present in a "|" delimited file. Ex: If a have a file with data as a|b|c|d|e|f|g|h|k|l|m|n I want to display every 3rd feild which means the output should be c f k n Please help me. (1 Reply)
Discussion started by: ngkumar
1 Replies

9. Shell Programming and Scripting

finding matches between multiple files from different directories

Hi all... Can somebody pls help me with this... I have a directory (dir1) which has many subdirectories(vr001,vr002,vr003..) with each subdir containing similar text file(say ras.txt). I have another directory(dir2) which has again got some subdir(vr001c,vr002c,vr003c..) with each subdir... (0 Replies)
Discussion started by: bramya07
0 Replies

10. Shell Programming and Scripting

Calculating average for every Nth line in the Nth column

Is there an awk script that can easily perform the following operation? I have a data file that is in the format of 1944-12,5.6 1945-01,9.8 1945-02,6.7 1945-03,9.3 1945-04,5.9 1945-05,0.7 1945-06,0.0 1945-07,0.0 1945-08,0.0 1945-09,0.0 1945-10,0.2 1945-11,10.5 1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
3 Replies
USBHIDACTION(1) 					    BSD General Commands Manual 					   USBHIDACTION(1)

NAME
usbhidaction -- perform actions according to USB HID controls SYNOPSIS
usbhidaction -c config-file [-d] [-i] -f device [-t table] [-v] [arg ...] DESCRIPTION
usbhidaction can be used to execute commands when certain values appear on HID controls. The normal operation for this program is to read the configuration file and then become a daemon and execute commands as the HID items specify. If a read from the HID device fails the pro- gram dies; this will make it die when the USB device is unplugged. The options are as follows: -c config-file Specify a path name for the config file. When running as a daemon this needs to be an absolute path for the HUP signal to work. -d Toggle the daemon flag. -i Ignore HID items in the config file that do not exist in the device. -f device Specify a path name for the device to operate on. If device is numeric, it is taken to be the USB HID device number. If it is a relative path, it is taken to be the name of the device under /dev. An absolute path is taken to be the literal device pathname. -t table Specify a path name for the HID usage table file. -v Be verbose, and do not become a daemon. The config file will be re-read if the process gets a HUP signal. CONFIGURATION
The configuration file has a very simple format. Each line describes an action; if a line begins with a whitespace it is considered a con- tinuation of the previous line. Lines beginning with `#' are considered as comments. Each line has three parts: a name of a USB HID item, a value for that item, and an action. There must be whitespace between the parts. The item names are similar to those used by usbhidctl(1), but each part must be prefixed by its page name (use the -v flag to usbhidctl(1) to see the page name). Replace spaces in the item name by underscores. The value is simply a numeric value. When the item reports this value the action will be performed. If the value is `*' it will match any value. The action is a normal command that is executed with system(3). Before it is executed some substitution will occur: `$n' will be replaced by the nth argument on the command line, `$V' will be replaced by the numeric value of the HID item, `$N' will be replaced by the name of the control, and `$H' will be replaced by the name of the HID device. FILES
/usr/share/misc/usb_hid_usages The HID usage table. EXAMPLES
The following configuration file can be used to control a pair of Philips USB speakers with the HID controls on the speakers. # Configuration for various Philips USB speakers Consumer:Consumer_Control.Consumer:Volume_Up 1 mixerctl -f $1 -n -w outputs.master++ Consumer:Consumer_Control.Consumer:Volume_Down 1 mixerctl -f $1 -n -w outputs.master-- Consumer:Consumer_Control.Consumer:Mute 1 mixerctl -f $1 -n -w outputs.mute++ Consumer:Consumer_Control.Consumer:Channel_Top.Microsoft:Base_Up 1 mixerctl -f $1 -n -w outputs.bass++ Consumer:Consumer_Control.Consumer:Channel_Top.Microsoft:Base_Down 1 mixerctl -f $1 -n -w outputs.bass-- A sample invocation using this configuration would be usbhidaction -f /dev/uhid1 -c conf /dev/mixer1 This configuration file can be used for various keyboards with extra keys: # Configuration for extra keyboard keys Consumer:Consumer_Control.Consumer:Volume_Up 1 mixerctl -n -w outputs.master++ Consumer:Consumer_Control.Consumer:Volume_Down 1 mixerctl -n -w outputs.master-- Consumer:Consumer_Control.Consumer:Mute 1 mixerctl -n -w outputs.mute++ Consumer:Consumer_Control.Consumer:Pause/Play 1 xmms -p Consumer:Consumer_Control.Consumer:Stop 1 xmms -s Consumer:Consumer_Control.Consumer:Scan_Previous_Track 1 xmms -r Consumer:Consumer_Control.Consumer:Scan_Next_Track 1 xmms -f And this configuration can be used with, e.g., usbhidaction -f /dev/uhid0 -c conf -i SEE ALSO
usbhidctl(1), usbhid(3), uhid(4), usb(4) HISTORY
The usbhidaction command first appeared in NetBSD 1.6. BSD
October 20, 2004 BSD
All times are GMT -4. The time now is 02:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy