All Questions
51 questions
1
vote
4
answers
6k
views
sed command to replace last occurrence of a word in a file with the content of another file
macOS sed command to replace last occurrence of a word in a file
Replace with the content from another file
Replace only the last occurrence, means only once.
The word can be a substring abchello or ...
3
votes
2
answers
7k
views
How to loop through file and execute the lines
I have a text file that contains bash commands for fetching some data from a database. Each command is separated with a newline. See an example below: (the commands could also have been "ls -l&...
0
votes
1
answer
588
views
Search a value for one column and retrieve concatenated values from other columns of a file
I have a text file which has 4 columns and data looks like:
P_ID C_ID Code MSG
10 12 001 abcd
20 21 003 jklm
10 ...
0
votes
0
answers
84
views
How to parse a specific column and keep only a part with awk
I have a file like this A.txt (field separator = ,) :
Kit Batch Export
Software Version = NO_v1
Date And Time of Export =
Experiment Name = MY20195334_MOL_2014_20201006Run180017
Instrument Software ...
-2
votes
2
answers
689
views
covert Multi line into single line with grep name
Can you please help me this.
item : name_1
213321654
32549846546
item : name_2
8563161631
item : name_3
96315242161
73216510631
51654316416
Need to convert
...
1
vote
2
answers
932
views
Print only one value from duplicates [duplicate]
I have following content in a file.
$ cat file.txt
code-coverage-api
jsch
cloudbees-folder
apache-httpcomponents-client-4-api
apache-httpcomponents-client-4-api
jsch
apache-httpcomponents-client-...
-3
votes
1
answer
805
views
remove duplicate lines based on first three column values
I am getting a file with content below
The first three values might be repeating in other lines
I want to keep one instance and remove other duplicates
the output should be like below
0
votes
2
answers
425
views
generate a password with minimum 2 numbers, 2 CAPS, 1 symbol, x lower alpha and max length of 16
I tried pwgen and makepasswd to generate a password...
but these are not enough to generate with exact count of literals and numbers...
pwgen -c -n -y -B 12 1
This is not working as expected as I ...
0
votes
0
answers
51
views
Is there a way to pipe to a visual editor and then continue the pipeline? [duplicate]
I know that some command-line programs can open visual editors like Sublime in a "wait mode" which opens the editor, lets you edit, and on-close it resumes the program with the file contents (like git ...
8
votes
3
answers
1k
views
Looking for a way to view lines of a text file one-at-a-time centered on screen
I'm looking for a way to take a text file and put each line one-at-a-time centered on screen with a certain character width.
Sort of like a bare-bones slide show, e.g. seeing the first line until the ...
1
vote
3
answers
5k
views
How to separate a file into parts by delimiter
I have a text file as follows:
aaaa
bbbb
----
cccc
----
dddd
How can I use ---- as delimiter and take out for example dddd or cccc? By take out I mean run a command and get "dddd" if my input ...
0
votes
2
answers
2k
views
How to extract the key words containing row from an excel file?
I need to extract the key-words containing row from an excel file (.xls) as per the order specified in the given key-word file. For example
I have an excel file namely genome.xls as given below,
...
1
vote
2
answers
3k
views
how to add commas for every listed item
in my shell program i just cut the names in the server and display them,
echo `last | grep "pts" | sort | cut -d' ' -f1 | uniq | grep -v / `"."
gives me an output of
a22casti
a22sahot
a25zhang
...
2
votes
1
answer
9k
views
How to read a file with two columns into a script so that each line read as two variables
I have a file that has two columns like such.
cat test.txt
100 2007
FFF 1993
7E7 1994
4BB 1995
I need to input each of the lines into a script, and have the two columns assigned as separate ...
-2
votes
1
answer
1k
views
Insert today's date at the end of a text file - using bash
I have a text files that is generated through daily running bash script - I want to append a date field into that text file - how can I achieve it ?
Name NUM_OF_USERS
A------10
B------20
**date-...