Hi,
i wrote a script that reads (with getline) each row and and writes it to a target folder. The original file is split into parts, the delimiter is defined in the script.
i tried to call a awk script with 2 parameters:
awk -f Split.awk <file to split> <target folder>
awk -f Split.awk c:\awk\file.txt c:\awk\folder
The script:
BEGIN{
file = ARGV[1]
Folder = ARGV[2]
strOutfileName = "File_"
counter = 0
out = (Folder strOutfileName counter ".txt"
}
{
getline < file
if (/^xxx/){
close(out)
++counter
out = (Folder strOutfileName counter ".txt"
}
print > out
}
end{
close(out)
}
The file does its job but gives me an errormessage:
awk: Split.awk:52: (FILENAME=c:\awk\file.txt FNR=6240) fatal: cannot open file
`c:\awk\folder\' for reading (No such file or directory)
CAN ANYBODY GIVE ME A TIP??
THANXXX
i wrote a script that reads (with getline) each row and and writes it to a target folder. The original file is split into parts, the delimiter is defined in the script.
i tried to call a awk script with 2 parameters:
awk -f Split.awk <file to split> <target folder>
awk -f Split.awk c:\awk\file.txt c:\awk\folder
The script:
BEGIN{
file = ARGV[1]
Folder = ARGV[2]
strOutfileName = "File_"
counter = 0
out = (Folder strOutfileName counter ".txt"
}
{
getline < file
if (/^xxx/){
close(out)
++counter
out = (Folder strOutfileName counter ".txt"
}
print > out
}
end{
close(out)
}
The file does its job but gives me an errormessage:
awk: Split.awk:52: (FILENAME=c:\awk\file.txt FNR=6240) fatal: cannot open file
`c:\awk\folder\' for reading (No such file or directory)
CAN ANYBODY GIVE ME A TIP??
THANXXX