Skip to main content
added 65 characters in body
Source Link
guest_7
  • 5.8k
  • 1
  • 8
  • 13

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, using the sed editor is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

## or per K.Kusalanda method has a bug in it
## for empty list it generates wrong output
# printf '%sp\n' $list | sed -nf - longTextlonxt.txt

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, using the sed editor is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

## or per K.
# printf '%sp\n' $list | sed -nf - longText.txt

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, using the sed editor is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

## or per Kusalanda method has a bug in it
## for empty list it generates wrong output
# printf '%sp\n' $list | sed -nf - lonxt.txt
added 3 characters in body
Source Link
guest_7
  • 5.8k
  • 1
  • 8
  • 13

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, assuming GNUusing the sed, editor is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

## or per K.
# printf '%sp\n' $list | sed -nf - longText.txt

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, assuming GNU sed, is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

## or per K.
# printf '%sp\n' $list | sed -nf - longText.txt

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, using the sed editor is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

## or per K.
# printf '%sp\n' $list | sed -nf - longText.txt
added 68 characters in body
Source Link
guest_7
  • 5.8k
  • 1
  • 8
  • 13

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, assuming GNU sed, is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt 

## or per K.
# printf '%sp\n' $list | sed -nf - longText.txt

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, assuming GNU sed, is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt

Just place an echo before your sed command to see where n why you are going wrong.

One way to go, assuming GNU sed, is:

# assuming default IFS
## based on Kusalananda's observations
set -f ;# disable globbing
list="2 5 7 10"
for i in $list;do
  echo "${i}p"
done | sed -nf - longText.txt 

## or per K.
# printf '%sp\n' $list | sed -nf - longText.txt
added 68 characters in body
Source Link
guest_7
  • 5.8k
  • 1
  • 8
  • 13
Loading
Assumes GNU sed to be able to read script from "-". Small markup fixes
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
Source Link
guest_7
  • 5.8k
  • 1
  • 8
  • 13
Loading