How to determine 6000+ Strings in a Text file

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
User avatar
makh
Posts: 642
Joined: 2011-10-09 09:16

How to determine 6000+ Strings in a Text file

#1 Post by makh »

Hi

I made notes for my students, and named the clauses as, "but not in order" to teach them. The Numbers are 6000+:
Name-1 (1) : 1 SOME-DATA
Name-1 (1) : 2 SOME-DATA
Name-1 (1) : 3 SOME-DATA
...
...
Name-2 (2) : 1 SOME-DATA
[Optional Footnote: ] Extra emphasis of (2) : 1
Name-2 (2) : 2 SOME-DATA
...
...
Name-2 (2) : 100 SOME-DATA
Name-2 (2) : 101 SOME-DATA
[Optional Footnote: ] Extra emphasis of (2) : 101
...
...
So on...
Later I realized my mistake of numbering... :?

Now I am not sure how to check by or similar:

Code: Select all

grep -E -o '\(2) : 2|\(2) : 3' File.txt
I just want to see cross-check like:
(1) : 1
(1) : 2
(1) : 3
...
...
(2) : 1
(2) : 2
...
...
(2) : 100
(2) : 101
...
...
... but my bash skills are just average!

Thanks a lot for your kind support.
HP Probook 440 G2: Arch, Debian Stable
Server: none
Past: Debian, Centos, Ubuntu, Opensuse
GUI: Openbox, Cinnamon
Chroot: Debian, Ubuntu, Fedora
VM: Devuan

Employing the best:
Arabic
Debian
Homeopathic

For new: Try Linux Mint

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to determine 6000+ Strings in a Text file

#2 Post by Head_on_a_Stick »

Bumping this to share some nice potential solutions provided by members of the Arch forums:

https://bbs.archlinux.org/viewtopic.php?id=263027
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

ab1jx
Posts: 61
Joined: 2016-01-23 21:28
Location: Heath, MA, USA
Contact:

Re: How to determine 6000+ Strings in a Text file

#3 Post by ab1jx »

Search-replace in a text editor? I use Joe, which lets you select a block like the first 10 characters of each line on all lines. Also replace newlines with newliine <something>. You can define macros too.

Post Reply