Datasets:

Modalities:
Text
Formats:
json
Languages:
Norwegian
ArXiv:
Libraries:
Datasets
pandas
License:
File size: 796 Bytes
390edc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/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."