Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to determine 6000+ Strings in a Text file

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
makh
Posts: 651
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.
ThinkPad E14: Arch, Debian Stable
GUI: Xfce

For new: Try MX Linux, Linux Mint; later join Debian Stable

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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
deadbang

ab1jx
Posts: 111
Joined: 2016-01-23 21:28
Location: Heath, MA, USA
Has thanked: 2 times
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