USWAP(1)
π« USWAP β bestie edition π«
So like, <rainbow>uswap</rainbow> is a lil cutie from the General Commands Manual (section 1, obvs) and honestly? It's giving β¨endianness fairyβ¨.
πΈ NAME πΈ
uswap β converts the endianness of a Fortran unformatted file π¦
β¨ SYNOPSIS β¨
uswap [ -x ] [ -csfde..... ] [ -i infile ] [ -o outfile ]
π DESCRIPTION π
okay so here's the tea π« β uswap converts the endianness of a file that was written with Fortran's unformatted write command. So basically a dump file written on a big endian machine can be converted so it can be read on a little endian machine. Bestie, it's a whole long-distance relationship and uswap is the matchmaker π
The input and output files may be named, but if you don't name them? No worries, standard input and standard output get read from and written to instead. Iconic default behaviour honestly.
By default the records are assumed to contain data of 4 bytes size, like the default integer, logical, complex and real types. But you can set the size of the records right on the command line, no cap:
-cβ character data π-sβ short data (eg:integer*2,logical*2)-fβ float data (eg:integer,real,logical,complex)-dβ double precision data (eg:integer*8,real*8,double precision,double complex).-eβ extended precision data (eg:real*16,extended precision).
The following examples shows how a data file containing a character record, a double precision record, and a number of single precision records can be converted:
uswap -cdf -i infile -o outfile
See uread(1) to read the number of records in a Fortran unformatted data file, and to guess the record contents. π (she's the sister tool, go say hi.)
By default uswap will byte swap a file written on the host machine. But to byte swap a file written on a foreign machine with opposite endianness? Use the -x flag. that's it, that's the flag π¦
β οΈ NOTE β οΈ
The error message
uswap: data larger than file length
often indicates that the file being read has the opposite byte "sex" to the platform uread is being run on. (yes, the manpage says "sex", we're keeping it, it's a classic π)
Try using the -x flag to see if this is the case. lowkey this solves like 90% of your problems, fr fr.
π₯ SEE ALSO π₯
π AUTHOR π
S.E. Norris s.norris@auckland.ac.nz
and that's the whole page bestie, <rainbow>USWAP(1)</rainbow> out β shoutout to S.E. Norris for the authoring and to the General Commands Manual for the home, no date on this one so we're just sending it with love π«Άβ¨ periodt.
π¦ where this page comes from
- fedora 43: uread 0-0.35.20081006.fc43 Β· GPL-1.0-or-later
- fedora 44: uread 0-0.36.20081006.fc44 Β· GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms