I have a file that is pipe delimited and in Column F they have number values, both positive and negative. I need to take the one file I am starting with and split it into two separate files based on negative and positive numbers. What is the command to do so? And then I need to also transfer each of those files with 2 separate names to an SFTP server. I was trying something with an awk command, but I was told that using the split command might make this easier. Below is what I started with. Any help would be appreciated.
Set a field separator!
Pipe delimited: -F"|" or BEGIN {FS="|"}
Then your initial code will work.
The previous post sets a pipe or space as the FS. (And it determines a column named F in the first line.)
Some input and desired output samples might help.
I don't see the split nor the csplit tool to distribute lines to different target files based on a single field's contents. Try instead
If you don't want the sixth field to be the selector but the non-predetermined field labeled "F", use nezabudka's proposal to determine the relevant field number. Make sure there's only one field labeled "F"!