Created
July 17, 2024 10:27
-
-
Save jeansymolanza/b9171394261ddea833ed0f0dcc0657b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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