Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:17:51+00:00 2026-06-09T12:17:51+00:00

F1.txt tom a b c d e boy bob a b c sun harry

  • 0

F1.txt

tom a b c d e boy

bob a b c sun

harry a c d e girl

result

F2.txt

tom1 a1 b1 c1 d1 e1 boy1

tom2 a2 b2 c2 sun2

tom3 a3 c3 d3 e3 girl3

Hello everyone, I am quite new to Perl,can you kindly help me out with this new problem of mine. I have a file F1.txt, my job is to assign numbers after each string in a file according to its line number as shown in an example above. I have so far just managed to assign a number to each of the lines with this Perl one-liner

perl -pe '$_= ++$a." $_" if /./'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:17:53+00:00Added an answer on June 9, 2026 at 12:17 pm

    Maybe as follows:

    perl -pe 's/(?<=\w)\b/$./g;'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

F1.txt bob tom harry F2.txt bob a=1 b=2 c=3 bob d=4 e=5 f=6 tom
F1.txt boy a s b/b/b see girl d e w/w/w day result F2.txt b/b/b
file1.txt hello tom well file2.txt world jerry done How to merge file1.txt with file2.txt;
F1.txt tom1 a1 b1 c1 bob2 d2 e2 f2 result F2.txt a1 b1 c1
file1.txt aaaa bbbb cccc dddd eeee file2.txt DDDD cccc aaaa result bbbb eeee If
test.txt Welcome notice ------------------------ Hello there, welcome! Foo hello world Bar Yes! Foo How
.txt file need save in SD-card. Save(n + String.valueOf(key) + .txt); private void Save(String
txt = 1aaa5 Then txt.split(a) produces [1, , , 5] in ruby 1.9. Anyone
My TXT file contains these: Škoda Fábia farba: Červená 05050 Škoda Fábia farba: Metalíza
file.txt contains: ##w## ##wew## using mac 10.6, bash shell, the command: cat file.txt |

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.