Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

binheader.sh 640 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  1. #!/usr/bin/env bash
  2. # Test that binary headers are handled properly
  3. gmt math -T1/50/1 -o1 T 10 MUL = t.txt
  4. gmt math -T1/50/1 -o1 -bo1f T 10 MUL = t.b
  5. cat << EOF > header.txt
  6. # This is one line pf junk
  7. # This is another line of junky stuff........................
  8. EOF
  9. # Compute the size of the header in bytes
  10. h=$(ls -l header.txt | awk '{print $5}')
  11. # Make binary file with leading junk header
  12. cat header.txt > junk.b
  13. cat t.b >> junk.b
  14. # Run gmt convert which will strip off the headers on output, then compare
  15. gmt convert junk.b -bi1f -hi${h} > out1.txt
  16. gmt convert t.txt > out2.txt
  17. diff out1.txt out2.txt --strip-trailing-cr > fail
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...