# Basic syntax:
xargs -a file_to_read -I {} command {}
# Where:
# - -a tells xargs to reads items from file_to_read instead of stdin.
# - -I specifies a string that will be replaced by the stdin when found.
# This is useful for controlling where the read content appears in the
# xargs command
# Note, it's often useful to use this in conjunction with -n 1 and -P # which
# causes xargs to run the commands in parallel using # processes
while read p; do
echo "$p"
done <peptides.txt
# Let's use a text file called file.txt
# the file contains 5 lines of some programming languages in use today:
$ cat file.txt
#Output:
# JavaScript
# Java
# C
# Python
# C#
# Method 1 'wc'
# 'wc' command can be used to find the number of lines, characters,
# words, and bytes of a file.
$ wc -l file.txt
# Or
$ wc -l < file.txt
# Or
$ wc -l file.txt
# Output:
# 10 file.txt
# OR
# Method 2 - 'sed'
# 'sed' is a stream editor that can be used to perform basic text transformation
# of an input file.
# This command is mostly used for find-and-replace functionality and
# can also be used to find the number of lines of a specified file.
$ sed -n '=' file.txt
# Output:
# 1
# 2
# 3
# 4
# 5
# Or
# sed -n '$=' which gives the overall number of lines
$ sed -n '$=' file.txt
# Output:
# 5
sed 'NUMq;d' file
xargs -I{} curl "xyz.com/v1/"{} <file