05-18-2011
Extracting specific lines of data from a file and related lines of data based on a grep value range?
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
19900110 12 216 129 -2.0089082E-02
19900111 12 240 129 -0.3891007
19900107 12 120 151 0.8195071
I want to extract all info from this file , and send it to file 2, that has a line with "240" and a value at the end between 0.8 and 1. Any line that matches this criteria i also want to extract the previous 5 lines of data (i.e. the previous 5 dates). All any any help is appreciated. I'm a new linux user.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a requirement, where based on a particular character on a single line, the data has to be written to new lines...
Ex: abccd$xyzll$bacc$kkklkjl$albc
My output should be
abccd$
xyzll$
bacc$
kkklkjl$
albc
Can someone help on this. (1 Reply)
Discussion started by: thanuman
1 Replies
2. Shell Programming and Scripting
hi all,
i searched in unix.com and accquired the following commands for extracting specific lines from a file ..
sed -n '16482,16482p' in.sql > out.sql
awk 'NR>=10&&NR<=20' in.sql > out.sql....
these commands are working fine if i give the line numbers as such .. but if i pass a... (2 Replies)
Discussion started by: sais
2 Replies
3. Shell Programming and Scripting
So I work in a 1 to 1 laptop deployment and sometimes we need to mass order parts. The vendor will send us a text file and we have to manually input serial numbers. Well I have a full blown web based inventory system which I can pull serial number reports from.
I then have to input the part... (4 Replies)
Discussion started by: tlarkin
4 Replies
4. Shell Programming and Scripting
Hi,
I have a very large log file in the following format:
198.28.0.0 - - 200 348
244.48.0.0 - - 200 211
198.28.0.0 - - 200 191
4.48.0.0 - - 200 1131
244.48.0.0 - - 200 1131
244.48.0.0 - - 200 1131
4.48.0.0 - - 200 1131
244.48.0.0 - - 200 211
4.48.0.0 - - 200 1131
... (2 Replies)
Discussion started by: sajal.bhatia
2 Replies
5. Shell Programming and Scripting
Hi,
Currently I am working on a script to automate the process of converting the log file from binary into text format. To achieve this, partly I am depending on my application’s utility for this conversion and the rest I am relying on shell commands to search for directory, locate the file and... (5 Replies)
Discussion started by: svajhala
5 Replies
6. UNIX for Dummies Questions & Answers
I have a text file called (msgz ) contains data :
Subscriber
Data ID = 2
Customer = 99
Data ID = 4
Customer = cf99
Data ID = 5
Customer = c99
Data ID = 11
Customer = 9n9
Subscriber
Data ID = 1
Customer = 9ds9
Data ID = 2
Customer = 9sad9
Data ID = 3
Customer = f99... (3 Replies)
Discussion started by: teefa
3 Replies
7. UNIX for Dummies Questions & Answers
I have a table to data which one of the columns include string of text
from within that, I am searching to include few lines but not others
for example I want to to include some combination of word address such as (address.| address? |the address | your address) but not (ip address | email... (17 Replies)
Discussion started by: A-V
17 Replies
8. UNIX for Advanced & Expert Users
Hello,
Is there a quick awk one-liner for this extraction?:
file1
49389 text55
52211 text66
file2
59302 text1
49389 text2
85939 text3
52211 text4
13948 text5
Desired output
49389 text2
52211 text4
Thanks!! (5 Replies)
Discussion started by: palex
5 Replies
9. UNIX for Dummies Questions & Answers
I need help extracting specific lines in a text file. The file looks like this:
POSITION TOTAL-FORCE (eV/Angst)
-----------------------------------------------------------------------------------
1.86126 1.86973 1.86972 ... (14 Replies)
Discussion started by: captainalright
14 Replies
10. Shell Programming and Scripting
Hi All,
I am stuck in one step..
I have one file named file.txt having content:
And SGMT.perd_id = (SELECT cal.fiscal_perd_id FROM $ODS_TARGT.TIM_DT_CAL_D CAL
FROM $ODS_TARGT.GL_COA_SEGMNT_XREF_A SGMT
SGMT.COA_XREF_TYP_IDN In (SEL COA_XREF_TYP_IDN From... (4 Replies)
Discussion started by: Shilpi Gupta
4 Replies
PMIDI(1) General Commands Manual PMIDI(1)
NAME
pmidi - A midi file player for ALSA.
SYNOPSIS
pmidi [ -pclient:port ] [ -l ] [ -ddelay ] file...
DESCRIPTION
The pmidi command reads in the specified midi files and plays them through the ALSA sequencer. You can specify on the command line which
sequencer port that you wish to use. Use the -l option to get a list of possible sequencer ports for your machine.
OPTIONS
-pclient:port
Specify the ALSA port to send the midi file to.
-l List the possible output ports that could be used.
-ddelay
Delay after song ends. This is used to prevent the last note of a song being chopped off early. The default is two seconds.
Port numbers
You can specify client:port numbers in the ALSA_OUTPUT_PORTS environment variable. You can also supply a comma (or space if quoted cor-
rectly) separated list of client:port numbers. This will allow you to play midi files that use more than 16 channels.
Examples
pmidi song.mid song2.mid
pmidi -p "64:0, 64:1" song.mid
TROUBLE SHOOTING
Before you start you need to have ALSA installed and configured correctly. This man page cannot cover all general ALSA topics, but here
are a few things to check when things do not seem to be working.
Checking ALSA
1. First check that the correct sequencer modules are loaded for your sound card:
- For a card with an external Midi connection, you need to load snd-seq-midi.
- For the OPL2/3 internal synthesiser you need to load snd-synth-opl3.
- For the AWE32/64 internal synthesiser you need to load snd-synth-emu8000.
- For the SB Live! internal synthesiser you need to load snd-synth-emu10k1.
- (Let me know of any more)
2a If you have an AWE32/64 or SB Live! you will need to load the sounds with sfxload in the same way as for the standard kernel drivers.
2b If you have the OPL3 FM synthesiser you will have to load the FM instruments with sbiload. See note below.
3. Make sure that the synth in the mixer is turned up and unmuted if appropriate.
Before use
Because you may have more than one sound card and each sound card may have several MIDI connections, you have to tell pmidi which one to
use.
First find out what the possibilities are for your system:
If you run:
pmidi -l
it will give you a list of the possible devices that it can play to. On my system I get:
Port Client name Port name
64:0 Rawmidi 0 - EMU10K1 MPU-401 (U EMU10K1 MPU - 401 (UART)
65:0 Emu10k1 WaveTable Emu10k1 Port 0
65:1 Emu10k1 WaveTable Emu10k1 Port 1
65:2 Emu10k1 WaveTable Emu10k1 Port 2
65:3 Emu10k1 WaveTable Emu10k1 Port 3
128:0 FLUID Synth (28152) Synth input port (28152)
129:0 Client-129 TiMidity port 0
129:1 Client-129 TiMidity port 1
Any of the port numbers in the first column can be used with pmidi. In the example above the first one is the external Midi port, the next
four are the internal wave table synthesiser. Then there are two software synthesisers running, FluidSynth (http://www.fluidsynth.org) and
Timididy.
If you don't see anything listed then check that the correct ALSA modules are loaded as in the section "Checking ALSA".
ENVIRONMENT
ALSA_OUTPUT_PORTS Port to use in playing midi file.
SEE ALSO
playmidi(1)
AUTHOR
Steve Ratcliffe <steve@parabola.demon.co.uk>
Dec 20 2003 PMIDI(1)