The script for viewing the dbf file compiled by shell

Source: Internet
Author: User
! Binkshhd-abdA $1 | sed-n & amp; 39; 1 p & amp; 39; | cut-c7-70 & gt; $ HOMEtmpFIRSTLINE $ DBFFLAG 'awk & amp; 39; {print $1} & amp; 39; $ HOMEtmpFIRSTLINE $ 'if [$ DBFF
  1. #! /Bin/ksh
  2. Hd-abdA $1 | sed-n '1p' | cut-c7-70> $ HOME/tmp/FIRSTLINE $
  3. DBFFLAG = 'awk' {print $1} '$ HOME/tmp/FIRSTLINE $'
  4. If [$ DBFFLAG-ne 3]
  5. Then
  6. Echo "this is not a database file! Aa"
  7. Exit 1
  8. Fi
  9. DEFSIZE = 'awk' {print ($9 + $10*256)} '$ HOME/tmp/FIRSTLINE $'
  10. STEP = 'AK' {print ($11 + $12*256)} '$ HOME/tmp/FIRSTLINE $'
  11. Dd if = $1 of = $ HOME/tmp/DBFEND $ bs = $ DEFSIZE skip = 1 2>/dev/null
  12. Fold-B-w $ STEP $ HOME/tmp/DBFEND $
  13. Rm $ HOME/tmp/FIRSTLINE $
  14. Rm $ HOME/tmp/DBFEND $
  15. > Echo

Note:"This is not a database file! Aa "," aa ": twice. if it is not a database file, a prompt is displayed! It is easy to use. for example, if the stored name is dbf, Then: $ dbf user. dbf: this is the database file you want to view. if you want to view the content of a dbf file, you can use it like this, in this way, you can generate a file or reference the pipeline to output the command to awk sed. I believe it is still a bit useful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.