How to determine 6000+ Strings in a Text file

Need help with C, C++, perl, python, etc?

How to determine 6000+ Strings in a Text file

Postby makh » 2021-01-23 16:32

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
makh
 
Posts: 642
Joined: 2011-10-09 09:16

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

Postby Head_on_a_Stick » 2021-01-28 15:46

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
User avatar
Head_on_a_Stick
 
Posts: 13262
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby ab1jx » 2021-01-30 22:56

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.
ab1jx
 
Posts: 56
Joined: 2016-01-23 21:28
Location: Heath, MA, USA


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable