Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeansymolanza/b9171394261ddea833ed0f0dcc0657b2 to your computer and use it in GitHub Desktop.
Save jeansymolanza/b9171394261ddea833ed0f0dcc0657b2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Sample line
line="value1|value2|...|value65|value66|..."
# Split the line into an array using '|' as the delimiter
IFS='|' read -r -a array <<< "$line"
# Access the item at index 65 (arrays are 0-indexed, so index 65 is the 66th item)
if [ ${#array[@]} -gt 65 ]; then
item_at_index_65="${array[65]}"
echo "Item at index 65: $item_at_index_65"
else
echo "Error: The array does not have an index 65."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment