to combine some rows of records from fileA with rows of records from fileB, there are “>” symbols (i.e., great than symbols) occupying some rows in the fileC. I wonder how I can suppress the write out of these “>” ?
I see. The context is that I am looking for a quick GMT solution to prepare a ASCII text file that will be fed into a mesh generator; therefore the need of removing those “>” characters.
That text file is a combination of two output files from other gmt programs.
Just to be clear, do you want to remove the segment marker within a multisegment file? Are the “>” in the original files (fileA.txt and fileB.txt)? Or were added by GMT when you use gmt convert?
There have been occasions when I’ve needed to do this type of thing, from time to time.
Since your files are text files, you can use an awk command.
After creating fileC.txt, and presuming that the “>” appear only in lines you want removed, issue this command:
awk ' $0 !~ />/ ' fileC.txt > fileD.txt
The !~ (no match) operation examines each line, and if “>” is found anywhere in the whole line, skip it, otherwise write-out all remaining lines. Awk is one of the foundational tools for scripting, and it operates very quickly. [Many pardons for those in the group who despise awk! ]