Sponsored Content
Top Forums Shell Programming and Scripting Bash to verify each line in input for specific pattern Post 302997665 by Don Cragun on Thursday 18th of May 2017 01:49:43 AM
Old 05-18-2017
Your description is rather confusing, I think the following may come closer to doing what you want:
Code:
awk '
NR == 1 {
	next
}
NR % 6 == 2 && /found expected header/ ||
NR % 6 == 3 && /found expected order of fields/ ||
NR % 6 == 4 && /R_Index is a number/ ||
NR % 6 == 5 && /PopFreqMax is valid/ ||
NR % 6 == 0 && /Quality is a character/ ||
NR % 6 == 1 && /HGMD and Sanger are valid/ {
	VAL++
}
NR % 6 == 1 {
	print " " $1, (VAL == 6) ? "is verified" : "is not verified"
	VAL = 0
}
' input.txt > verify.txt

If input.txt contains the sample input you provided in post #5 in this thread, the text produced by the above script in verify.txt exactly matches the output you said you wanted.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

merge columns into one line after a specific pattern

Hi all, im a linux newbie, plz help! I have a file - box -------- Fox-2 -------- UF29 zip42 -------- zf-CW SNF2_N Heli_Z -------- Fox -------- Kel_1 box (3 Replies)
Discussion started by: sam_2921
3 Replies

2. Shell Programming and Scripting

Bash Script verify user input is not empty and is equal to a value

I need to create a script that has a user enter a value. I want to verify that the value is either 1,2, or 3. If it is not then I want them to try entering it again. I am using a while loop to force them to retry. I am able to test the input against 1,2, and 3, but when I test agains an... (4 Replies)
Discussion started by: spartiati
4 Replies

3. Shell Programming and Scripting

Added new line before a specific pattern problem asking

Input file: Sample1 Type pattern 842 3150 Sample1 Type range 842 3150 Sample1 Type pattern 842 1127 Sample1 Type option 842 1127 Sample1 Type length 1483 1603 Sample1 Type pattern 1483 1603 Sample1 Type length 1698 1747 Sample1 Type option 1698 1747 Sample1 Type length 1868 1935 Sample1... (13 Replies)
Discussion started by: patrick87
13 Replies

4. Programming

Print specific pattern line in c++

Input file: @HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC +HWI-BRUNOP1_header_1 TNTTJTTTETceJSP__VRJea`_NfcefbWe Desired output file: >HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC >HWI-BRUNOP1_header_2... (10 Replies)
Discussion started by: cpp_beginner
10 Replies

5. Shell Programming and Scripting

Insert new pattern in newline after the nth occurrence of a line pattern - Bash in Ubuntu 12.04

Hi, I am getting crazy after days on looking at it: Bash in Ubuntu 12.04.1 I want to do this: pattern="system /path1/file1 file1" new_pattern=" data /path2/file2 file2" file to edit: data.db - I need to search in the file data.db for the nth occurrence of pattern - pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies

6. Shell Programming and Scripting

Help to just print out specific line from an input file

Hi, I have a file which contains 2,500,500,432 lines. Can I know what command I should type in order just print out particular line from the input file? eg. I just wanna to see what is the contents at line 522,484,612. Thanks for advice. (3 Replies)
Discussion started by: perl_beginner
3 Replies

7. Shell Programming and Scripting

Replace string in line below specific pattern?

Hi, I'm trying to replace a string with sed, in a text file containing this pattern: location alpha value x location beta value y location gamma value y location delta value y location theta value z ... What I want to achieve is: Find location beta into text file... (1 Reply)
Discussion started by: TECK
1 Replies

8. Shell Programming and Scripting

Replace the line with specific pattern

Hello All I'm trying to change one string from a file contening this patern: xxxx-xxxx 4 numbers - end 4 other numbers This is a sample of the file: LDR 00679 am a2200205 4500 =001 3617 =008 030219s2000\\\\xxx|||||\||||\00|\0\spa\d =020 \\$a0211-1942 =041 \\$aCastellà =093 ... (5 Replies)
Discussion started by: ldiaz2106
5 Replies

9. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

10. Shell Programming and Scripting

Need to cut a specific pattern from a line

Hello, I need to cut a specific pattern from a line irrespecitve of knowing field place. I am aware to cut field if you know the place of the field, but for me The sting place varies. 1468129514436,0,something_error,Non HTTP response code: java.net.URISyntaxException,Non HTTP response... (5 Replies)
Discussion started by: mirwasim
5 Replies
trcs(1) 							   User Manuals 							   trcs(1)

NAME
trcs - convert text files from one codeset to other SYNOPSIS
trcs -C | -l | -h trcs [-s] [-f input-codeset ] [-t output-codeset ] [ file ]... DESCRIPTION
trcs is a program for translation of text files from one codeset to other. When exact translation is impossible it tries to make approxi- mations. For example pseudographic characters are approximated by ASCII characters in codesets that have no pseudographic characters and characters with diacritical marks are approximated by existing characters. If the option -s or --gen-script is given trcs will generate simple script that invokes tr(1) This is useful if you want to include this in your script or for faster conversion of many files. If none of -C, -s, -l, -h and their equivalents is given each file will be read assuming it is coded with codeset input-codeset On standard output it will be recoded so to use codeset output-codeset If there is no file given trcs will act as filter. Both input-codeset and out- put-codeset are case insensitive and default to `cp1251'. OPTIONS
-C, --copyright Display copying conditions and warranty information. -s, --gen-script Generates conversion script for given input and output encodings instead to convert text files. -l, --list List all known codesets with their aliases. -h, --help Display this help and exit. -f input-codeset, --from[=]input-codeset Codeset of the source. -f output-codeset, --to[=]output-codeset Codeset of the output. EXAMPLES
trcs -fcyrillic -t koi8-r letter.txt Convert letter.txt from ISO-8859-5 (cyrillic) to KOI8-R and output the result on standard output. trcs --from cp437 --to=mik --gen-script >ibm2mik Generates script ibm2mik for converting from CP437 to MIK. sh ibm2mik screen.txt Convert screen.txt from CP437 to MIK. Output the result on standard output. Without parameters ibm2mik acts as filter. AUTHOR
Anton Zinoviev <anton@lml.bas.bg>, <zinoviev@fmi.uni-sofia.bg> SEE ALSO
tr(1) Linux JUN 2000 trcs(1)
All times are GMT -4. The time now is 11:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy