Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Please help with Linux script to compare file two fields values Post 303044252 by mamtsism on Monday 17th of February 2020 10:49:29 AM
Old 02-17-2020
Please help with Linux script to compare file two fields values

I need to compare two dates for each line of the .txt file. If value in position 11 is equal to ‘02407' and ‘21100220' minus ‘19860220' equal to 124 years I want to bypass this record, otherwise I want this record written to the output.

This is a sample data in the file:

19860220 02407 21100220

19660121 02501 20200218

19670301 02501 20200218

19880420 03105

I am trying to accomplish this with SED or AWK command.

Last edited by mamtsism; 02-19-2020 at 10:58 AM.. Reason: To show data and change post details.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need awk script to compare 2 fields in fixed length file.

Need a script that manipulates a fixed length file that will compare 2 fields in that file and if they are equal write that line to a new file. i.e. If fields 87-93 = fields 119-125, then write the entire line to a new file. Do this for every line in the file. After we get only the fields... (1 Reply)
Discussion started by: Muga801
1 Replies

2. UNIX for Advanced & Expert Users

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

3. UNIX for Dummies Questions & Answers

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

4. Shell Programming and Scripting

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (3 Replies)
Discussion started by: yerruhari
3 Replies

5. Shell Programming and Scripting

Compare two files based on values of fields.

Hi All, I have two files and data looks like this: File1 Contents #Field1,Field2 Dist_Center_file1.txt;21 Dist_Center_file3.txt;20 Dist_Center_file2.txt;20 File2 Contents (*** No Header ***) Dist_Center_file1.txt;23 Dist_Center_file2.txt;20 Dist_Center_file3.txt;20 I have... (4 Replies)
Discussion started by: Hangman2
4 Replies

6. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

7. UNIX for Dummies Questions & Answers

Compare values of fields from same column with awk

Hi all ! If there is only one single value in a column (e.g. column 1 below), then return this value in the same output column. If there are several values in the same column (e.g. column 2 below), then return the different values separated by "," in the output. pipe-separated input: ... (11 Replies)
Discussion started by: lucasvs
11 Replies

8. Shell Programming and Scripting

LINUX - How to compare the values in 2 files & exit from the script

Hi All, I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further. For e.g : Scenario 1 In this case, the script should exit without proceeding further. Scenario 2 In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies

9. UNIX for Advanced & Expert Users

Script to parse and compare information in two fields of file

Hello, I am working parsing a large input file1(field CFA) I have to compare the the file1 field(CFA byte 88-96) with the content of the file2(It contains only one field) and and insert rows equal in another file. Here is my code and sample input file: ... (7 Replies)
Discussion started by: GERMANOS
7 Replies

10. Programming

Python script to grep fields and use values from file 1 as argument for another command

Hi Experts, I am working one one python script in version 3.x and 2.6. Need your support to complete it Basically for both commands i have telnet to device and run command and then receiving input File 1 and File 2 I have two commands, need to grep data and output in csv file. Next script/code... (0 Replies)
Discussion started by: as7951
0 Replies
record(1)						      General Commands Manual							 record(1)

NAME
record - records *.wav files SYNOPSIS
record [ options ] DESCRIPTION
record records *.wav files in CD quality (i.e. 44100 Hz, 16bit, stereo). It has a input level meter, which might be useful for sound trou- ble shooting (check if the mixer settings ok for recording from the TV card etc.) OPTIONS
-h display help text -o file basename for the output file(s), a number and the .wav extention are added by record. Default is "record". -i dev mixer control. This should be the one where you can adjust the record level for your audio source. Default is "line". "mic" and "igain" are good candidates too. Best way to figure is to start your favorite mixer tool and check out which one works ... -m dev set mixer device. Default is "/dev/mixer". -d dev set audio device. Default is "/dev/dsp". -r rate set sample rate. Default is 44100. -p sec peak seconds (number of seconds which should be scanned for the volume maximum). This affects both peak level display and level triggered recording (see below). Default is 1.5 seconds. record can also be used non-interactive: -c enable console (non-interactive) mode. -v be verbose (console mode only). -t mm:ss Limit the record time (console mode only). By default record records until stopped by a signal (by typing ^C for example). -s size Limit the file size (console mode only). record will continue with a new file once the limit is reached. -l Enable level triggered recording (console mode only) with the default trigger level (1000). -L level Enable level triggered recording with the specified trigger level. If level triggered recording is active, record will start and stop recording depending on the signal strength. Recording will be started if the signal strength is above the trigger level (1000/32768 => around 3%). Recording will be stopped if the signal is below the trigger level for some time (1.5 seconds by default, the -p switch changes this). AUTHOR
Gerd Knorr <kraxel@bytesex.org> (c) Gerd Knorr record(1)
All times are GMT -4. The time now is 08:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy