Search Results

Search: Posts Made By: deal1dealer
642
Posted By RudiC
With that sparse specification, limited sample...
With that sparse specification, limited sample extent, just guessing the record structure (8 fields) and assuming the second record to be incomplete, how about
awk -F^ '{while (NF <= 7 && 1 ==...
3,092
Posted By Corona688
Why 'file' and not 'file4', or does that matter? ...
Why 'file' and not 'file4', or does that matter?

awk '/^A/ { if(F) close(F); F=sprintf("%s%d", NAME, ++N) } { print > F }' NAME="File" inputfile Use nawk on solaris.
3,092
Posted By Corona688
You could also do file0001, file0002, etc, etc,...
You could also do file0001, file0002, etc, etc, which sorts more nicely in a directory listing, by putting "%s%04d" in sprintf instead.
3,092
Posted By drl
Hi. Utility csplit was designed for these...
Hi.

Utility csplit was designed for these kinds of tasks, so:
csplit -k -z data1 '/^A/' '{*}'
produces byte counts and creates files:
56
56
42
56

xx00 xx01 xx02 xx03
Sample, contents...
3,092
Posted By RudiC
Just in case the input file does not start with...
Just in case the input file does not start with an "A" record, try awk '/^A/ || NR==1 { if(F) close(F); F=sprintf("%s%d", NAME, ++N) } { print > F }' NAME="File" inputfile
Showing results 1 to 5 of 5

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