Skip to content
Programmingoneonone
Programmingoneonone
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerRank Sed command #2 problem solution

YASH PAL, 31 July 20246 February 2026

In this HackerRank Sed command #2 problem solution In this challenge, we will practice using the sed command to parse and transform text.

Task

For each line in a given input file, transform all the occurrences of the word ‘thy’ with ‘your’. The search should be case insensitive, i.e. ‘thy’, ‘Thy’, ‘tHy’ etc. should be transformed to ‘your’.

Input Format

A text file will be piped into your command via STDIN.

Output Format

Transform and display the text as required in the task

HackerRank Sed command #2 problem solution

Problem solution.

sed 's/thy/your/gi'

Second solution.

sed 's/bthyb/your/gi'

Third solution.

sed 's/(^| )thy( |$)/1your2/gi'

Fourth solution.

sed 's/<[tT][hH][yY]>/your/g'

coding problems solutions Hackerrank Problems Solutions linux shell HackerRankLinux shell

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes