This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert these IDs with slash (/) sign to a list?

For example, converting this:

948369/947077/945082/948443/947139/944753/944750/946344/948378/944902/948665/948655/947097/948697/945693/948698/948688/944885/946525/947178/947912/948430/948429/945099/948200/948192/946315/945173/945085/948690/945371/945392/947519/945830/947056/948233/946648/947672/945887/946179/945425/947567/947970/947859/948403/945081/945066/946430/945304/947398/947666

To this kind of format:

948369
947077
945082
948443
947139
944753
944750
946344
948378
944902
948665

It is cumbersome to remove the backward slash sign individually, when I have 500 of them for instance, and so I would like to do it simultaneously.

Thanks in advance :)

gene

1 answer

Try

$ echo "948369/947077/945082/948443/947139/944753/944750/946344/948378/944902/9" | tr "/" "\n"
948369
947077
945082
948443
947139
944753
944750
946344

cat if_in_a_file and then redirect to a new file if you want to save.

Thank you a million! Quick question, is it possible to do this execution on R as well?

Log in to answer this question.