Skip to main content

All Questions

0 votes
1 answer
115 views

Find all files in directory and apply commands to each of them

I want to apply commands below to all files in a directory instead of one file. cat file.txt | sed -E "s/\@([0-9]+)\W+~(.*?)/\1 \2/g" | tr -d '~' cat file.txt | sed -E "s/\@([0-9]+).*\~...
user1002601's user avatar
0 votes
1 answer
57 views

Replacing variable correctly in alias function

I'm trying to create an alias function to remove inputted line from file: function remove_line(){ line_to_remove="'s/^"$1"$//g'" sed -i $(line_to_remove) my_file } ...
ellat's user avatar
  • 137
-1 votes
2 answers
561 views

Use find, cat, etc... to generate an M3U playlist from album playlists

I have a music folder with selected playlists in each folder titled "playlist.m3u" (should also match *.m3u8). What I would like to do is have a shell script generate a playlist concatenated ...
mrjpaxton's user avatar
  • 109
2 votes
2 answers
516 views

Update any date to the current date in a text file

I have a text file which contains several occurrences of dates. All the dates are written in the format Mon-DD-YYYY. I have to update all these dates in the current date keeping the format Mon-DD-YYYY....
user9952796's user avatar
2 votes
2 answers
159 views

Unpivoting Delimited String to get the parent child relationship

I have a scenario where in need to unpivot the data to achieve the parent child relationship. My source data is as below: Key_Col|Hierarchy 1|a,b,c,d 2|a,b,c,d,e My Expected Output below: Key Col ...
MAK33's user avatar
  • 43
3 votes
1 answer
549 views

How to get the result of smbstatus into a shell script variable

Running smbstatus on the command line I get the following: ❯ smbstatus Samba version 4.17.3 PID Username Group Machine Protocol Version Encryption ...
KevDog's user avatar
  • 51
1 vote
0 answers
464 views

how do i put a $variable inside {curly..brackets} in a bash loop? [duplicate]

i'm writing a text art script where i take some input and repeat it, textbook simple. echo "a script that takes some input and repeats it 100 times" read -e -p "text input " ...
noisebob's user avatar
2 votes
2 answers
54 views

get delimiter index and convert EPOCH time

I need to search time in the first line and get the position index and then convert other lines' EPOCH time to human readable time. The EPOCH time position is random but it has a header. Sample as ...
Minos Liao's user avatar
1 vote
3 answers
108 views

get specific output in linux after string

Controller loading lists... ------------------------------------------------- command: select SERVICE_NAME from <table_name> ------------------------------------------------- ...
Leo Shukla's user avatar
0 votes
1 answer
147 views

Permutation with bash - Spread Five over Eight

Assuming I have the values A B C D E and eight places 1 2 3 4 5 6 7 8. How can I get all possible combinations printed with two- and three-time repetitions? Example: 1 2 3 4 5 6 7 8 _______________ A ...
nath's user avatar
  • 6,074
0 votes
1 answer
76 views

Perform text-processing task on remote server using shell variable specified on local machine

I'm trying to write a shell script that proceses user information on a remote server via SSH. The user to be processed will be read interactively by the script. My current attempt looks like this #!/...
User82949B's user avatar
0 votes
1 answer
5k views

add a new line after a specific string in a file? [duplicate]

Right now I'm using echo sed '/\Random/a \ newly added line' info.txt to append some text to a file but I also need to add text below a certain string let's say random, I know it is possible with ...
Nawaz Moin yaakuza's user avatar
0 votes
1 answer
2k views

RegEx to extract file paths from a logfile

I need to get the file paths from a log file. I thought I will try this with regex. A file path would look like this: 75/751234/751234V0001_test-tag1-tag02-75x75_01.jpg I'm not a pro in Regex, so I ...
Scamus's user avatar
  • 15
0 votes
4 answers
479 views

Merge 2 CSV file to create one CSV file with one more column of difference

I have 2 CSV files. Let's call them 1.csv and 2.csv The first one (1.csv) looks as follows: 1,3543 23,3632 12,7665 1,9795 32,8793 35,0290 The second file (2.txt) looks as follows: 1,4543 3,3223 4,...
Xat Shar's user avatar
0 votes
2 answers
649 views

How to match multiple keywords in a log file that occur on the same line using bash script

I created an array with keywords to match in a log file and display the matching lines on standard output. If a line contains more than one keyword, I want the output to highlight all the keywords ...
Cruise5's user avatar
  • 546

15 30 50 per page
1
2 3 4 5
14