@Stephen :
awk -v num=2 'FNR % num == 0 {print $0 ORS ">"++q ;next} 1' Input_file
마찬가지로, 위의 줄 번호를 제공 할 수 및 출력에 다음을 인쇄 할 수 있습니다 :보십시오. 또한 사용자가 여러 Input_files를 사용할 때마다 다음 파일이 올 때마다 FNR의 값을 재설정하고 다음 Input_file (NR은 수행하지 않음)에서 처음부터 시작할 것입니다.
편집 : 코드의 전체 설명을 추가해도됩니다. 나는 간단한 쉘 스크립트 (upline.sh를) 이렇게 wolud
awk -v num=2 #### Setting a variable named num to value 2 here.
'FNR % num == 0 #### Checking condition if FNR%num==0 is TRUE then it should perform following actions. Where FNR is awk built-in keyword to get the line number, only difference between FNR and NR is FNR gets RESET whenever a new Input_file gets read. As we know awk could read multiple Input_files, so
in this case FNR could be really helpful compare to NR.
{print $0 ORS ">"++q ; #### printing the current line's value(off course when above condition is TRUE) with ORS(output field separator) whose default value is new line and then printing ">" and a variable named q whose value will always increase each time cursor comes in this section.
next} #### mentioning next keyword here which will help us to skip all other further statements when this condition met so that we could save our time.
1 #### awk works on condition then action pattern so here by putting 1 I am making condition as TRUE and then specifying no action so by default print will happen which will print the entire line.
' Input_file #### mentioning the Input_file here.
* 파일을 분할하고 싶습니다. * 파일을 여러 파일로 나눕니다. 또는 각 만 줄 뒤에'>> n '을 삽입 하시겠습니까? – RomanPerekhrest
각 1M 라인 이후에> n을 삽입하기 만하면됩니다. 다운 스트림 '>'을 사용하는 소프트웨어에서 분할을 나타냅니다. 아마도 파일을 '해체'하면 더 좋은 용어가됩니다. –
awk가 sed보다 더 나은 선택이 될 것입니다 ... – Sundeep