Article 588C9 Hello from Arizona

Hello from Arizona

by
LSnodgrass
from LinuxQuestions.org on (#588C9)
Very interested in Embedded Linux, config management, regular expressions, command line 'pipeline' puzzles and solutions.

Puzzles like this:

# For each text file in this directory,
# replace the row (line) in the file beginning with <path//>
# with "<path//>" and the fully qualified pathname
# something like
# <path//> /c/Users/john.smith/Documents/glossary.txt
#
# And better yet, perform a regex on the 'realpath' value, changing it into a
# Windows path like this:
# <path//> C:/Users/john.smith/Documents/glossary.txt
#
for filename in $(find . -type f -depth 1 -iname '*.txt' | xargs realpath)
do
sed -i.bak -n -e '/<path\/\/>/ {s/<path\/\/>.*$/<path\/\/> ${filename}/ }' ${filename}
echo Done ${filename}
done

# Again, this is just an introduction, not a legitimate post for assistance.
# And no, the bash + sed script above doesn't work yet.
# It's "the kind of" problems I am interested in solving from the command line
# as opposed to other solutions like writing a custom C, C++, C#, Python, Perl, PowerShell
# script.
#

A quote I really like:
"The best way to learn something is to try explaining it to the computer."latest?d=yIl2AUoC8zA latest?i=WwzwYnfNc2c:MGiMSbDR0-c:F7zBnMy latest?i=WwzwYnfNc2c:MGiMSbDR0-c:V_sGLiP latest?d=qj6IDK7rITs latest?i=WwzwYnfNc2c:MGiMSbDR0-c:gIN9vFwWwzwYnfNc2c
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments