awk가 작동하지 않는데, 혹시 해본 적이 있나요?

awk가 작동하지 않는데, 혹시 해본 적이 있나요?

이에 대한 도움에 미리 감사드립니다.

아래 awk 명령을 실행하려고 하는데 작동하지 않습니다. 이전에 많은 표현식에 대해 정확한 명령을 실행했는데 훌륭하게 작동했습니다. 5개의 표현식만으로 실행해 보았지만 여전히 작동하지 않습니다. 어떤 아이디어가 있나요?

5열에 나열된 표현식이 포함된 모든 행을 삭제하고 싶습니다. awk가 작동하지 않는 경우 대안은 무엇이며 이에 대한 명령을 제공할 수 있습니까?

미리 감사드립니다.

앗 5달러! 대략 HG00449|HG00451|HG00452|HG00457|HG00458|HG00463|HG00464|HG00472|HG00473|HG00475|HG00476|HG00478|HG00479|HG00500|HG00513|HG00524|HG00525|HG 00530|HG00533|HG00534|HG00536|HG00537|HG0 0542|HG00543| HG00551|HG00553|HG00554|HG00556|HG00557|HG00559 |HG00560|HG00565|HG00566|HG00580|HG00581|HG00583|HG00584|HG00589|HG00590|HG00592|HG00593|HG0 0595|HG00596|HG00598|HG00599|HG00607|HG00608|HG0 0610|HG00611 |HG00613|HG00614|HG00619|HG00620|HG00622|HG00623|HG00625|HG00626|HG00628|HG00629|HG00631|HG00632|HG00634|HG00637|HG00640|HG00641|HG00650|HG0 0651|HG00653|HG00654|HG00656|HG0 0657|HG0 0662|HG00663 |HG00671|HG00672|HG00674|HG00675|HG00683 |HG00684|HG00689|HG00690|HG00692|HG00693|HG00698|HG00699|HG00701|HG00704|HG00705|HG00707|HG00708|HG0 0717|HG00728|HG00729|HG00731|HG00732|HG0 0734|HG0 0736 |HG00737|HG00739|HG00740|HG00742|HG00743|HG00759|HG00766|HG00844|HG00851|HG00864|HG00867|HG00879|HG00881|HG00956|HG00978|HG00982|HG01028|HG0 1029|HG01031|HG01046|HG01047|HG01048|HG0 1049|HG01051| HG0 1052|HG01054|HG01055|HG01058|HG01060|HG01061 |HG01063|HG01064|HG01066|HG01067|HG01069|HG01070|HG01072|HG01073|HG01075|HG01077|HG01079|HG0 1080|HG01082|HG01083|HG01085|HG01086|HG01088|HG0 1089| HG01092|HG0 1094|HG01095|HG01097|HG01098|HG01101|HG01102|HG01104|HG01105|HG01107|HG01108|HG01110|HG01111|HG01112|HG01113|HG01121|HG01122|HG 01124|HG01125|HG01130|HG01131|HG01133|HG0 1134|HG01136| HG01137|HG0 1139|HG01140|HG01142|HG01148|HG01149 |HG01161|HG01162|HG01164|HG01167|HG01168|HG01170|HG01171|HG01173|HG01174|HG01176|HG01177|HG0 1182|HG01183|HG01187|HG01188|HG01190|HG01191|HG0 1197| HG01198|HG01200|HG0 1204|HG01205|HG01241|HG01242|HG01247|HG01248|HG01250|HG01251|1284|HG01286|HG01302|HG01303|HG0 1305|HG01308|HG01311 HG01312 |HG01323|HG01325|HG01326|HG01341|HG01342|HG01344| HG01345|HG01348|HG01350|HG01351|HG01353|HG01354|HG01356|HG01357|HG01359|HG01360|HG01362|HG01363|HG01365|HG01366|HG01369|HG0 1372장 01390 |HG01392|HG01393|HG01395|HG01396|HG01398|HG01402|HG01403 |HG01405|HG01412|HG01413|HG01414|HG01431|HG01432|HG01435|HG01437|HG01438|HG0 1440|HG0 1441|HG01443|HG01444|HG01447|HG01455|HG01456|HG01459| HG01461|HG01462|HG01464|HG01465|HG01468|HG01474|HG01479 |HG01485|HG01486|HG01488|HG01489|HG01491|HG01492|HG01494|HG01495|HG01497|HG01498|HG0 1550|HG01551|HG01556|HG01565|HG01566|HG01571|HG01572|HG0 1577 |HG01578|HG01583|HG01586|HG01589|HG01593|HG01595| HG01596|HG01597|HG01598|HG01599|HG01600|HG01794|HG01795|HG01796|HG01797|HG01798|HG01799|HG0 1800|HG01801|HG01802|HG01804|HG01805|HG01806|HG0 1807|HG01808|HG01809|HG01810|HG01811|HG01812|HG01813|HG01813 |HG01815|HG01816|HG01817|HG01840|HG01841|HG01842|HG01843|HG01844|HG01845|HG01846|HG01847|HG01848|HG0 1849|HG01850|HG01851|HG01852|HG01853|HG 01855 |HG01857|HG01858|HG01859|HG01860|HG01861|HG01862|HG01863|HG01864|HG01865|HG01866|HG01867|HG01868|HG01869|HG01870|HG01871|HG01872|HG01873|HG01874|HG01878|HG0 1879|HG0188 0|HG01882|HG01883|HG01885|HG01886|HG01889| HG01890 |HG01892|HG01893|HG01894|HG01896|HG01912|HG01914|HG01915|HG01917|HG01918|HG01921|HG01923|HG01924|HG01926|HG01927|HG01932|HG01933|HG0 1935|HG0 1936|HG01938|HG01939|HG01941|HG01942|HG01944| HG01945|HG01947|HG01948|HG01950|HG01951|HG01953|HG01954|HG01956|HG01958|HG01965|HG01967|HG01968|HG01970|HG01971|HG01973|HG01974|HG0 1976|HG0 1977|HG0 1979|HG01980|HG01982|HG01985|HG01986|HG01988 | HG01989|HG01990|HG01991|HG01992|HG01997|HG02002|HG02003|HG02006|HG02008|HG02009|HG02010|HG02012|HG02013|HG02014|HG02016|HG02017|HG02019|HG0 2020|HG02023|HG0 2025|HG02026|HG02028|HG02029|HG02031| HG02032|HG02035|HG02040|HG02047|HG02048|HG02049|HG02050|HG02051|HG02052|HG02054|HG02057|HG02058|HG02060|HG02061|HG02064|HG02067|HG0 2069|HG0 2070|HG02072|HG0 2073|HG02075|HG02076|HG02078|HG02079 | HG02081|HG02082|HG02084|HG02085|HG02086|HG02087|HG02088|HG02089|HG02090|HG02095|HG02102|HG02104|HG02105|HG02107|HG02108|HG02111|HG02113|HG0 2116|HG02121|HG02122|HG0 2127|HG02128|HG02130|HG02131| HG02133|HG02134|HG02136|HG02137|HG02138|HG02139|HG02140|HG02141|HG02142|HG02144|HG02146|HG02147|HG02150|HG02151|HG02152|HG02153|HG0 2154|HG0 2155|HG02156|HG02164|HG0 2165|HG02166|HG02178|HG02179 | HG02180|HG02181|HG02182|HG02184|HG02185|HG02186|HG02187|HG02188|HG02190|HG02250|HG02252|HG02253|HG02255|HG02256|HG02259|HG02260|HG02262| HG02265|HG02266|HG02271|HG02272|HG0 2274화 HG02285|HG02286 |HG02291 |HG02292|HG02298|HG02299|HG02301|HG02304|HG02308|HG02309|HG02312|HG02314|HG02315|HG02317|HG02318|HG02322|HG0 2323장 HG02345|HG0 2348| HG02351|HG02353|HG02355|HG02356|HG02360|HG02364 |HG02367 |HG02371|HG02373|HG02374|HG02375|HG02379|HG02380|HG02382|HG02383|HG0 2384장 HG02407|HG02408|HG02409|HG02410|HG02419|HG02420 |HG02425 |HG02427|HG02429|HG0 챕터 2433HG02462|HG02464|HG02465|HG02470|HG02471|HG02476|HG02477|HG02479|HG02481|HG02484|HG02485|HG02489|HG02490|HG 02491|HG 02493|HG02494|HG02496|HG0 챕터 2497HG02521 |HG02522|HG02536| HG02537|HG02541|HG02545|HG02546|HG02549|HG02555|HG02557|HG02558|HG02561|HG02562|HG02568|HG02570|HG02571|HG0 2573장 HG0 2588|HG02589| HG02594|HG02595|HG02597|HG02600|HG02601 |HG02603|HG02604| HG02610|HG02611|HG02613|HG02614|HG02620|HG02621|HG02623|HG02624|HG0 2628장 HG02660|HG02661|HG02666|HG02667|HG02675 |HG02676|HG02678| HG02679|HG02681|HG0 2682장 HG02731|HG02733|HG02734|HG0273 6|HG02737|HG02756|HG02757 |HG02759|HG02760|HG02763|HG02768|HG02769|HG02771|HG02774|HG02775|HG02778|HG02780|HG02783|HG02784|HG02786|HG0 2787|HG02789|HG02790|HG02792|HG 02793|HG02798|HG02799|HG0 2804 |HG02805|HG02807|HG02808 |HG02810|HG02811|HG02813|HG02814|HG02816|HG02817|HG02819|HG02820|HG02836|HG02837|HG02839|HG02840|HG02851|HG02852|HG02854|HG02855|HG02860|HG02861|HG02870|HG02878|HG02879|HG0 2881 HG02895|HG02896|HG02922|HG02923|HG02938|HG02941| |HG02944|HG02946|HG02947|HG02952|HG02953|HG02968|HG02970|HG02971|HG02973|HG02974|HG0 2976장 HG03009|HG03012|HG03015|HG03016|HG03018|HG0 3019| HG03021|HG03022|HG03024|HG03025|HG03027|HG03028| |HG03040|HG03045|HG03046|HG03048|HG0 3049|HG03052|HG03054|HG03055|HG03057|HG03058|HG03060|HG03061|HG03063|HG03064|HG03066|HG03069|HG 03072|HG 03073|HG03074|HG03077|HG03078|HG03079|HG03081|HG03082 |HG03084|HG03085|HG03086|HG03088|HG03091|HG0 3095|HG03096|HG03097|HG03099|HG03100|HG03103|HG03105|HG03108|HG03109|HG03111|HG03112|HG03114|HG 03115|HG03117|HG03118|HG03120|HG03121|HG03123|HG03124 HG03126|HG03127|HG03129|HG03130|HG03132|HG03133|HG0 3135|HG03136|HG03139|HG03157|HG03159|HG03160|HG03162|HG03163|HG03166|HG03168|HG03169|HG 03172|HG03175|HG03189|HG03190|HG03193|HG03195|HG03196 |HG03198 |HG03199|HG03202|HG03209|HG03212|HG03224|HG03225|HG0 3228|HG03229|HG03234|HG03235|HG03237|HG03238|HG03240|HG03241|HG03246|HG03247|HG0 3258|HG 03259|HG03265|HG03267|HG03268|HG03270|HG03271 |HG03279|HG03280|HG03291|HG03294|HG03295|HG03297|HG03298|HG03300|HG0 3301|HG03303|HG03304|HG03311|HG03313|HG03342|HG03343|HG03351|HG03352|HG 03354|HG 03363|HG03366|HG03367|HG03369|HG03370|HG03372 |HG03376|HG03378 |HG03380|HG03382|HG03385|HG03388|HG03391|HG03394|HG03397|HG0 3401|HG03410|HG03419|HG03428|HG03432|HG03433|HG03437|HG03439|HG0 3442|HG 03445|HG03446|HG03449|HG03451|HG03452|HG03455 |HG03457|HG03458|HG03460|HG03461|HG03464|HG03469|HG03470|HG03472|HG03473|HG0 3476장 HG03499|HG03511|HG03514|HG03515|HG03517|HG03518|HG03520 |HG03521|HG0 3538|HG03539|HG03547|HG03548|HG03556|HG03557 |HG03558|HG03559|HG03563|HG0 3565장 |HG03619|HG 03624|HG03625|HG03629|HG0 3631장 HG03646| HG03649|HG03652|HG03653|HG03660|HG03663|HG03667|HG03668|HG03672|HG03673|HG03679|HG03680|HG03681|HG03684|HG03685|HG03686|HG03687|HG0 챕터 3689HG 03690HG0 3691HG03692HG03693HG03694HG03695HG03696 HG03697|HG03698|HG03702|HG03703|HG03705|HG03706|HG03708| HG03709 |HG03711|HG03713|HG03714|HG03716|HG03717|HG03718|HG03720|HG03722|HG03727|HG0 3729HG03화 742화 1|HG03772|HG03773|HG03774|HG03775|HG0377 7|HG0377 8|HG03779|HG03780|HG03781|HG03782|HG03784 | HG03785|HG03786|HG03787|HG03788|HG03789|HG03790|HG03792|HG03793|HG03796|HG03800|HG03802|HG03803|HG03805|HG0 3808|HG03809|HG03812|HG03814|HG0 3815|HG03817|HG03821|HG03823|HG03824|HG03826|HG03829| HG03830|HG03832|HG03833|HG03836|HG03837|HG03838|HG03844|HG03846|HG03848|HG03849|HG03850|HG03851|HG03854|HG03856|HG0 3857장 03870|HG03871|HG03872|HG03873|HG03874|HG03875|HG03882| HG03884|HG03885|HG03886|HG03887|HG03888|HG03890|HG03894|HG03895|HG0 3896장 HG03897 HG03898 HG03899 HG03900 HG03902 HG03905 HG03907HG03908|HG03910|HG03911|HG03913|HG03914|HG03916|HG03917|HG03919|HG03920|HG03922|HG03925|HG03926|HG03928|HG03931|HG03934|HG03937|HG03940|HG0 3941 HG03953|HG03955|HG03960|HG03963|HG03965|HG03967| |HG03969|HG03971|HG03973|HG03974|HG03976|HG03977|HG03978|HG03985|HG03986|HG03989|HG0 3990|HG03991|HG03995|HG03998|HG03999|HG04001|HG0 4002|HG 04003|HG04006|HG04014|HG04015|HG04017|HG04018|HG04019 |HG04020|HG04022|HG04023|HG04025|HG04026|HG04029|HG04033|HG04035|HG04038|HG04039|HG04042|HG0 4047|HG04054|HG04056|HG04059|HG04060|HG04061|HG0 4062|HG04063|HG04070|HG04075|HG04076|HG04080|HG04090 HG04093|HG04094|HG04096|HG04098|HG04099|HG04100|HG04106|HG04107|HG04118|HG04131|HG04134|HG04140|HG0 4141장 HG04144 HG04146 HG04152 HG04153 HG0 4155 HG04156 HG04158 HG04159|HG04161|HG04162|HG04164|HG04171|HG04173|HG04176| HG04177 |HG04180|HG04182|HG04183|HG04185|HG04186|HG04188|HG04189|HG04194|HG04195|HG0 4198|HG04200|HG04202|HG04206|HG04209|HG04210|HG04211|HG0 4212|04214|HG04216|HG04219|HG04222|HG04225|HG04227|HG04229 | NA1 8517|NA18519|NA18520|NA18522|NA18523|NA18525|NA18526 |NA18528 |NA18530|NA18531|NA18532|NA18533|NA18534|NA18535|NA18536|NA18537|NA18538|NA18539|NA1 8541|NA18542|NA18543|NA18544|NA18545|NA18546|NA1 8547|NA1 8548|NA18549|NA18550|NA18552|NA18553|NA18555 |NA18557|NA18558|NA18592|NA18593|NA18595|NA18596|NA18597|NA18599 |NA18602|NA18603|NA18605|NA18608|NA18609|NA18610|NA18 611|NA18612|NA18613|NA18614|NA1 8615|NA18616|NA18617| NA18618|NA18619|NA18620|NA1 8621|NA18622|NA18623|NA18624|NA18625|NA18626|NA18627|NA18628|NA18629|NA18630|NA18631|NA18632|NA18633|NA18634|NA1 8635|NA18636|NA18637|NA18638|NA18644|NA1 645|NA18646| NA18647|NA18648|NA18740|NA18745|NA18747|NA18748 |NA18749|NA18757|NA18853|NA18856|NA18858|NA18861|NA18864|NA18865|NA18867|NA18868|NA18870|NA188 71|NA1 8873|NA18874|NA18876|NA18877|NA18878|NA1 8879| NA18881|NA18907|NA18908|NA18909|NA18910|NA18912|NA18915|NA18916|NA18917|NA18924|NA18933|NA18934|NA18939|NA18940|NA18941|NA18942|NA18943|NA18 944|NA1894 5|NA18946|NA18947|NA18948|NA18 949|NA18950| NA18951|NA18952|NA18953|NA18954|NA18956|NA18957 |NA18959|NA18960|NA18961|NA18962|NA18963|NA18964|NA18965|NA18966|NA18967|NA18968|NA18969|NA189 70|NA18971|NA1 8972|NA18973|NA18974|NA18975|NA1 8976| NA18977|NA18978|NA18979|NA18980|NA18981|NA18982|NA18983|NA18984|NA18985|NA18986|NA18987|NA18989|NA18990|NA18991|NA18994|NA18995|NA18 997|NA1 001|NA19002|NA19003|NA19004|NA19005|NA19006|NA19007 |NA19009 |NA19010|NA19011|NA19012|NA19017|NA19019|NA19020|NA19023|NA19024|NA19025|NA19026|NA19027|NA19028|NA19030|NA19031|NA1 9035|NA19036|NA1 9037|NA1 9038|NA19041|NA19042|NA19043|NA19054|NA19055|NA19056|NA19057|NA19059|NA19060|NA19062|NA19063|NA19064|NA19065|NA19068|NA19070|NA19072|NA19074|NA19075|NA1 9 076|NA19077|NA19078|NA1 9079|NA19080|NA19081|NA19082|NA19083 | NA19084|NA19085| NA19086|NA19087|NA19088|NA19089|NA19090|NA19091|NA19092|NA19093|NA19096|NA19098|NA19099|NA19102|NA19107|NA19108|NA 9113|NA19114|NA19116|NA191 17|NA19118|NA19119|NA19121| 75|NA1 9184| NA19185|NA19189|NA19190|NA19197|NA19198|NA19200 |NA19201| NA19204|NA19206|NA19209|NA19210|NA19213|NA19214|NA19222|NA19223|NA19225|NA19236|NA192 38|NA19239|NA19247|NA19248|NA19 256|NA1 9257|NA19307| NA19308|NA19309|NA19310|NA19312|NA19314|NA19315|47|NA19350|NA1 9351|NA19355|NA19372|NA19374|NA19375 |NA19376|NA19377|NA19378 79|NA19380|NA19383|NA19384|NA19385|NA19390|NA19391|NA19393 |NA19394|NA19395|NA19397|NA19399|NA19401|NA19403|NA19 404|NA19428|NA1 9429|NA19430|NA19431|NA19434|NA19435|NA19436|NA19437|NA19438| 463|NA19466|NA1 9467|NA19468|NA19471|NA19472| NA19473 |NA19474|NA19475|NA19625| NA19648|NA19649|NA19651|NA19652|NA19654|NA19655|NA19661|NA19663|NA19664|NA19669|NA19670|NA19676|NA19 678|NA19 679|NA19681|NA1 9682|NA19684|NA19700|NA19701| NA19704|NA19707|NA19711|32|NA19734|NA19735|NA19740|NA1 9741|NA19746|NA19747|NA19749 |NA19750|NA19752|NA19755|NA19756|NA19758|NA19759|NA1976 1|NA19762|NA19764|NA19770|NA19771|NA19774|NA19776|NA19777 |NA19779|NA19780|NA19 782|NA19783|NA19785|NA19786|NA1 9788|NA19789|NA19792|NA19794|NA19795|NA19818|NA19819|NA19834|22|NA19923|NA19982|NA19 984|NA20126|NA2 0127|NA20274|NA20276 |NA20278| NA20281|NA20282|NA20287|NA20289|NA20291|NA20294|NA20296|NA20298|NA20299|NA20314|NA20317|NA20318|NA20320|NA20321|NA20332|NA20334|NA2 0339|NA2 0340|NA20342|NA20346|NA20348|NA2035 1|NA20355| NA20357|NA20359|NA20362|NA20412|NA20845| 61|NA20862|NA20863|NA20864|NA20866|NA20867|NA2 0868|NA20869 |NA20870|NA20872|NA20874|NA20875|NA20876 |NA20877|NA20878|NA20881|NA20882|NA20884|NA20885|NA20886 |NA20887|NA20888|NA20889|NA20890|NA20891|NA20 892|NA20894|NA20895|NA20896|NA20897|NA20899|NA2 0900| NA20901|NA20902|NA20903|NA20904|NA20905|NA 20906|NA20908|94|NA21095|NA21097|NA21098|NA21099 |NA21100|NA21101|NA21102|NA21103|NA21104|NA21105|NA21106|NA21107|NA21108|NA21109|9|NA21120|NA21122|NA21123|NA21124|NA21125|NA21126|NA21127|NA2 1128 |

답변1

진지하게, 이 정규식은 말도 안됩니다.

대신 간단한 텍스트 파일에 문자열(한 줄에 하나씩)을 쓰고 다음을 사용하세요.

grep -v -w -F -f patternfile inputfile >outputfile

inputfile그러면 에 나열된 문자열이 포함되지 않은 행만 출력됩니다 patternfile. 이 플래그를 사용하면 문자열이 정규 표현식 대신 문자열로 처리됩니다(이로 인해 메모리 사용량이 줄어들 수도 있음) -F. grep-w플래그는 단어의 하위 문자열이 아닌 전체 단어와 일치함을 보장합니다(예: NA21130일치 NA21130하고 일치하지 않음 GNA21130또는 NA211301).

열 5에서 문자열을 구체적으로 찾으려면 다음을 수행하십시오.

awk 'NR == FNR { pattern[$0] = 1; next } !pattern[$5]' patternfile inputfile >outputfile

먼저 문자열을 patternfile문자열로 색인화한 배열로 읽어옵니다. 그런 다음 inputfile열 5의 값이 배열의 인덱스인지 여부를 읽고 테스트합니다. 그렇지 않으면 라인이 통과됩니다.


또한 POSIX 시스템에서는 명령줄과 현재 환경(모든 환경 변수 및 해당 값)에 허용되는 최대 결합 길이가 최소 4KB가 보장됩니다. 대부분의 시스템에서는 이보다 많거나 적지만 Argument list too long질문에 있는 16KB 명령줄과 같은 명령을 실행하려고 할 때 오류 메시지를 받을 준비를 해야 합니다.

답변2

grep을 사용하여 이 문제를 해결했습니다.

grep –v –E '(HG00403|HG00404|HG00406|...(16KB 용어)...|NA21142|NA21143|NA21144)' < All_Combined_Individual_Data_RD23022018.txt > 코카서스인_Individual_Data_RD26022018.txt

관련 정보