Skip to main content
compatibility
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118

Simple awk command:

awk 'NR%2==0{ print > ("File "++i" ++i) }' RS='"' fileinfile

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the current record $0 into a File #.

Simple awk command:

awk 'NR%2==0{ print > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the current record $0 into a File #.

Simple awk command:

awk 'NR%2==0{ print >("File " ++i) }' RS='"' infile

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the current record $0 into a File #.

added 2 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118

Simple awk command:

awk 'NR%2==0{ print $0 > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the current record(  $0) into a File #.

Simple awk command:

awk 'NR%2==0{ print $0 > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the record($0) into a File #.

Simple awk command:

awk 'NR%2==0{ print > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the current record  $0 into a File #.

Improved grammar in explanation
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118

Simple awk command:

awk 'NR%2==0{ print $0 > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If the record number was 0 modulo of 2 (because we have another first " for records), then print the record($0) into a File #.

Simple awk command:

awk 'NR%2==0{ print $0 > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If record number was 0 modulo 2 (because we have another first " for records), then print the record($0) into a File #.

Simple awk command:

awk 'NR%2==0{ print $0 > "File "++i }' RS='"' file

RS defines " as record separator and NR is the record number. If the record number was modulo of 2 (because we have another first " for records), then print the record($0) into a File #.

deleted 42 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118
Loading
deleted 11 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118
Loading
added 17 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118
Loading
added 129 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118
Loading
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118
Loading