Datasets:

Languages:
Norwegian
Multilinguality:
monolingual
Size Categories:
1K<n<10K
Language Creators:
found
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
Tags:
License:
pere's picture
test
e5cc83c
#!/bin/bash
# Check if a file path is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <path_to_tsv_file>"
exit 1
fi
# Assign the file path to a variable
file_path="$1"
# Check if the file exists
if [ ! -f "$file_path" ]; then
echo "Error: File does not exist."
exit 1
fi
# Read each line from the file and count the number of fields
while IFS= read -r line; do
# Count the number of tabs, add 1 for the number of columns
col_count=$(echo -n "$line" | grep -o $'\t' | wc -l)
let col_count+=1
# Check if the number of columns is 2
if [ "$col_count" -ne 2 ]; then
echo "Error: Incorrect number of columns. Expected 4, but got $col_count in line: $line"
exit 1
fi
done < "$file_path"
echo "All rows have the correct number of columns."