Skip to content
Advertisement

Tag: unix

grep lines that contain 1 character followed by another character

I’m working on my assignment and I’ve been stuck on this question, and I’ve tried looking for a solution online and my textbook. The question is: List all the lines in the f3.txt file that contain words with a character b not followed by a character e. I’m aware you can do grep -i ‘b’ to find the lines that

Equivalent to named pipes in Unix for LIFO/Stack structure

I have been looking at all the different types of Unix file: regular files, directories, device files, symbolic link, doors, socket, named pipes,… but I couldn’t find a file type that would behave like a stack/LIFO structure. As most of you know, the advantage of FIFO/named pipe over regular files is the following: from https://askubuntu.com/questions/449132/why-use-a-named-pipe-instead-of-a-file Almost everything in Linux can

‘Housekeeping’ script to create folder and move files

I have been trying to investigate how to automate a script (shell or other) that periodically (once an hour for example) moves files with a constant naming convention to a folder (which is automatically created if not already there). The files are like this: Camera1_01_20171213221830928.jpg Camera1_01_20171213223142881.mp4 Basically it will be doing ‘housekeeping’. I’m new to shell scripts, and I just

How can I pass in this echo statement into my function in bash?

So in my while loop I am trying to figure out how to pass in the echo statement into my function bitToSixtyFour as a parameter. It is saying that bitToSixtyFour is not found. Answer As defined the function takes argument $1 from command line : to read from standard input read it would be more efficient to use a variable

What really happens when deleting file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question

Not able to change DOCTYPE line of a xml file in bash

I have a xml file with name alphabet.xml like below : – Now I want to replace <!DOCTYPE models SYSTEM “mp.dtd”> String of alphabet.xml with <!DOCTYPE models SYSTEM “/opt/nms_cif_mp/dat/mp.dtd”> code I am using is in below . But with this code replacement of the above specific string is not happening . NOTE : The above code logic works if I

How to store command arguments which contain double quotes in an array?

I have a Bash script which generates, stores and modifies values in an array. These values are later used as arguments for a command. For a MCVE I thought of an arbitrary command bash -c ‘echo 0=”$0″ ; echo 1=”$1″‘ which explains my problem. I will call my command with two arguments -option1=withoutspace and -option2=”with space”. So it would look

egrep two identical numbers and two identical letters n times

Hi I’ve been having trouble with the command egrep. Here is my question: Lets just say I was running in a for loop on these words: I only want to print the word if it has two identical numbers and two identical letters and the word repeats itself. for example in this case the only words that should print are:

Advertisement