Skip to main content

All Questions

Tagged with
1 vote
2 answers
86 views

Arranging the lines in required order

A file contains lines as follows: acb/xyz/row<t> acb/xyz/row<t> abc/xyz/row<1> abc/xyz/row<1> abc/xyz/row<0> abc/xyz/row<0> abc/xyz/row<3> abc/xyz/row<3>...
Manjunath's user avatar
0 votes
1 answer
120 views

Find the highest number after specific string from mutiple files

Each file has similar content: number 1: asdfa11sdfsadf number 2: asdfa12sdfsadf number 1: asdfa1sdfsadf number 3: asdfa33sdfsadf return 3 or number 3: are equally good. Have tried: max="$( awk ...
Maxfield's user avatar
  • 161
0 votes
1 answer
218 views

Sorting lines based on certain digit pattern

Assume I have a text file with the following lines: 192.168.1.1.55555 192.168.1.1.55555 192.168.1.1.5555 192.168.1.1.555 192.168.1.1.55 192.168.1.1.55 192.168.1.1.5 8.8.8.8.4433 8.8.8.8.443 8.8.8.8....
Zarkos.Fina's user avatar
7 votes
2 answers
2k views

Print count number of unique pattern occurences after each occurence

Supposing I have a log file containing thrown Exceptions: ExceptionA loggedFunctionCall ExceptionB ExceptionA loggedFunctionCall ExceptionD ExceptionB loggedFunctionCall ExceptionB I want to count ...
komidawi's user avatar
  • 179
0 votes
1 answer
304 views

Sort bash output by a number extracted from a specific column

I am new to bash and I am struggling with the following task: The output from UGE looks like this: mgenkin@bamdev2:~/projects/BrainFlowUtilities/BrainFlowSimulations$ qstat job-ID prior name ...
Mikhail Genkin's user avatar
0 votes
1 answer
209 views

Why is sed not doing what is defined in the locale collation file for grep (and sed, awk)?

Having a file with all the (printable) ascii characters: $ printf '%b' "$(printf '\\U%x\n' {32..126})" > file That could be sorted (using tr to reduce the long output to one line): $ sort file | ...
user avatar
4 votes
2 answers
10k views

Sort lines according to date and time

I have this file which represents a calender. Each file has the exact date and time, then the name event and a note. 06-12-2016,12:00,gym,leg day 05-04-2018,12:09,gym,hands 09-08-2019,13:08,movies,...
StillLearning's user avatar
4 votes
2 answers
841 views

Getting the last lines that matches a pattern in multiple files

I have an application that outputs a set of log files to a central directory like this: /tmp/experiment/log/ ├── node01.log ├── node02.log ├── node03.log ├── node04.log ├── node05.log ├── node06....
Dash83's user avatar
  • 183
1 vote
2 answers
2k views

Count unique lines only to a set pattern

How can I count the unique log lines in a text file only until the first "-" and print the line with the count org.springframework. - initialization started org.springframework. - initialization ...
rcmpayne's user avatar
-1 votes
2 answers
192 views

Extract text from a file based on some criteria

I have a file which contains records like those: 434419\Teclu\Tudor\1501\9502 187650\Cosma\Sorin\1504\9253 239474\Teclu\Daniel\1502\5245 844936\Gaman\Mihai\1505\4074 942341\Avram\Tudor\1505\4543 ...
adikinzor's user avatar
0 votes
2 answers
79 views

Dumping files based on specific word

I have a file: begin path: good take this way easier path end begin path: bad You shouldn't go there end begin path: good Very smooth end begin path: bad you may face ...
Mishkat Hasan's user avatar
0 votes
4 answers
1k views

How to identify, sort descending and display the top 10 blocks of text, by category

The history of transactions done on an entity within our systems look like below: 1 BYM1 TSTAB 09NOV 0035 CAB Sometext 01 2 BYM1 TSTAB 09NOV 0035 CAB Can be done - question 3 BYM1 TSTAB ...
Laxii's user avatar
  • 3
0 votes
1 answer
1k views

Monitoring Server Connections - Netstat formatting issue

I have had a few issues with a server recently. So i just wanted to leave a window showing the unique and IP's of connected devices. I have been using: watch -n 5 "netstat -tn 2>/dev/null | grep :...
Dave Hamilton's user avatar
4 votes
3 answers
11k views

How to show CPU time for processes via top without 'root' procs

Okay, So I've been attempting this for about three hours now without success. How do you search/display/use the top command (or ps command if it works...) to output a list of all procs, sorted by CPU ...
nom's user avatar
  • 45
5 votes
3 answers
4k views

sort a file based on length of the column/row

I need to sort a file based on the number of chars in the first column. I have no idea on how to go about this. (On Linux, so sed/awk/sort is available). An example: .abs is bla bla 12 .abc is bla ...
user avatar