Skip to content
Advertisement

How to select the nth char from a string for each line in a file?

Every line has a word and a number. I need somehow to select the nth letter which all together will make a new word. For example:

JavaScript

it has to start like this

JavaScript

and I’m only allowed to use sed (no awk, perl, …).

I know how to select all the numbers

JavaScript

or the text

JavaScript

and I was thinking about

JavaScript

but it won’t work because it won’t iterate thought all the lines and for some reason it won’t even work on a single line.

Need some help and guidance pls

Ty

Advertisement

Answer

JavaScript

Output:

JavaScript

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement