Skip to content

Instantly share code, notes, and snippets.

@Rogach
Created March 1, 2021 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rogach/663843cd072339b04541649dda35ea87 to your computer and use it in GitHub Desktop.
Save Rogach/663843cd072339b04541649dda35ea87 to your computer and use it in GitHub Desktop.
issue when copying contents of a file into a variable
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
TTTфTфTффффTTTффTфффффTTTTфTTTффTTфTTфTTTфTффффT
ффTфTTTTTTфTTTTффффTTTфTффTTфффTфTTTфTфффTTTTTTT
фффTфTTTфффTфTфффффTффTффTTTфффTTфTффффTTTфффTфф
TTTфффTTффTфTфффTфффффффTTффTTфTфффTTффффTTфTффT
ффTTфTTфTфTTTфTфффффффффTфTTTффTфTTTTTфTTTTTTфTT
фффTфTффTфффTTTTффTTTфффTффTфTффTффTфTффTTфTTTфф
ффTфTфTTTTффTфTфффTTфффTфTфффTTTTффTTTTфTффTфффT
#!/bin/bash
var1=$(echo)
var2="TффффTфффффTфTффTTTфффTфффTфTф_$(date -Is)"
var3="$(cat input.tsv)"
# This one is just needed to visualize the error,
# using `set -x` shows that var3 already contains the incorrect data
echo "$var3" | iconv -f utf8 > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment