Search Results

Search: Posts Made By: rangermax
12
awk
2,018
Posted By rangermax
Thanks.. okay the second } was missing after the...
Thanks.. okay the second } was missing after the close..
nawk -v n=500 'BEGIN { f="file0"}/^HDR/ {if (!(++c%n)) {close f; f= "file" c/n;}}{print > f}' myFile

---------- Post updated at 02:25 PM...
12
awk
2,018
Posted By rangermax
Thanks but I want the lines following HDR into...
Thanks but I want the lines following HDR into the output as well..
12
awk
2,018
Posted By rangermax
Yes, looks like 10 is the max number of files but...
Yes, looks like 10 is the max number of files but our file can have million records..

---------- Post updated at 01:40 PM ---------- Previous update was at 01:20 PM ----------

so, can we not do...
12
awk
2,018
Posted By rangermax
Yes, I did see that but I would like to send x...
Yes, I did see that but I would like to send x number(say 500) of HDR's into one file and then switch to next file... so on..
12
awk
2,018
Posted By rangermax
No, I would like to split this file into several...
No, I would like to split this file into several files and each of those sub files can have lets say 100 HDR records...
12
awk
2,018
Posted By rangermax
awk
Lets say we have a file called abc.txt and it's contents are -
HDR..
B1234..
D1234..
HDR..
T1234...
S1234..
HDR..
....

We would like to split this file into sub files starting with HDR...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 08:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy