Hot answers tagged

7

Use perl: perl -pe 's/(?<=\[)(\d+)(?=\])/$1+1/ge' prova.txt Explanation: -p means loop over every line and print the result after every line -e defines the expression to execute on every line s/from/to/ does a simple substition s/(\d+)/$1+1/ge matches one or more digits, captures it into $1, and then the e modifier on the end tells perl that the ...


5

That mark is internal and not included anywhere in the packet or any of its headers. That means it gets lost when doing the actual outbound connection, and wouldn't be visible in the INPUT table of the target server, but you would see it in the OUTPUT table of the initiating machine. The point of supporting a mark in ping is to allow outbound routing ...


4

You're looking in the wrong place, because this isn't really to do with the mount command itself. What you're doing is mounting a special filesystem, in this case, a cgroups hierarchy, and the options happen to be how you attach different cgroup subsystems like cpu or memory. Red Hat* has some good documentation on cgroups in general and the mount options ...


4

This is referring to the fact that Linux (like all Unix-style systems) exposes most of the resources it manages through objects which look like files: /dev-style devices, /proc and /sys entries... In the context of your quote, this property is mentioned because it allows access permissions to be reasoned about in a consistent fashion.


4

You could also use awk: awk -F '[\\[\\]]' '{if ($2) { sub($2, $2 + 3)}} 1' prova.txt In fact, this can be slightly shortened to: awk -F '[\\[\\]]' '$2 { sub($2, $2 + 3)} 1' prova.txt


4

The pipes connect the output or the left command to the input of the right command. This has nothing to do with the length of the stream. However, each command in the pipeline still has it's own buffering rules. If you don't trigger them in each command you won't see them on the final output.


4

That's basically a duplicate of my answer on SO. However, since nobody mentioned the stdbuf command here, I felt like I should add that here as well. =============== Basically a process that reads from a pipe can consume the data byte by byte as soon as they are available in the pipe. However, as long as the programs are using std io functions of the libc, ...


3

The first reason that comes to mind is that since that is an absolute link (it points to /data/git and not ../git), this will allow it to still work even if you move the directory later. So, say you install the system in /data/git/git and then decide to move the final git directory somewhere else, say /foo/bar/git. Now, the /foo/bar/git/git link will still ...


3

C-b c already has a standard binding which it might be wise to leave unchanged. Choosing another character, eg C-b C you can setup a binding in your ~/.tmux.conf file as follows: bind C send-keys -t.- 'mvn install' Enter The -t.- means "the other pane". Enter stands for the key of that name, i.e. the newline at the end of the command.


3

You could use the -u option of sed to minimize buffering: cat | sed -u '' | sed ''


3

perl -p -e 's/\[(\d+)\]/"[" . ($1+3) . "]"/ge' dad85.txt This perl one-liner replaces any positive integer number (\d+) inside square brackets with that number incremented by 3. It uses the e regexp modifer to make perl evaluate the replace portion of the s/// operation as an expression. Output: (freqBiasL2[30]) (SatBiasL1[30]) (defSatBiasL2_L1[30]) ...


2

This is a warning based on information provided by the kernel. Misalignment mostly has performance impacts; on SSDs it may result in additional wear. It won't cause corruption! Software RAID 10 + LVM on mixed drives, sector alignment? has lots of useful information on this, including recipes to set things up correctly.


2

Subshells do have overhead. On my system, the minimal fork-exec cost (when you run a program from disk when the file ins't cold) is about 2ms and the minimal forking cost is about 1ms. With subshells, you're talking the forking cost alone, as no file needs to be execed. If the subshells are kept reasonable low, 1ms is quite negligible in human-facing ...


2

I know you've already solved your problem, but FYI you could have solved it with a very simple modification to your code : by inverting the sequence you loop over. Using {107..27..-1} (or more concisely {107..27}) would have been enough to solve your problem, since when replacing 30, only the original 30 would have been found, the 27 having not been ...


2

They are on the two keys to the right of P: pressing the first with Alt Gr produces "«", the second produces "»".


2

Android and Linux are two different operating systems. You can't just take an executable from one and run it on the other. The first hurdle is the kernel. Android and Linux are based on the same kernel, but they have a few different features. In particular, Android provides binders, which only exist in the mainstream kernel (the one found in Linux ...


2

The only things special you should need for building Raspberry Pi with graphics support, compared to other ARMs currently: linux-next kernel (to get the devicetree for vc4, until 4.7 is released) rasperrypi/firmware on a vfat partition However, building everything from scratch will be an exercise in frustration, and I would recommend starting from an ...


2

The detail which you are extracting from /proc/self/status is found in /proc/self/comm (without scripting). For the intended question: to determine which processes are interpreted and which are native, you cannot do this without knowing which processes are intended to be interpreters. After all, any process can rename itself via an exec call, using ...


2

According to the systemd.special man-page, you should use Before=poweroff.target. poweroff.target A special target unit for shutting down and powering off the system. Applications wanting to power off the system should start this unit. runlevel0.target is an alias for this target unit, for compatibility with SysV. Additionally, as I mentioned in my ...


2

Docker's website states that it can be installed on any 64 bit distribution of RHEL. However, the kernel must be 3.10 at a minimum. Check your kernel version first with the following command: uname -r.


2

If somebody needs the answer just in case, I found an acceptable(for me) approach. You just let the normal Unix/linux kernel to boot then you just kexec into grub or another bootloader. Maybe this could be scripted as an init script.


2

@Julie Pelletier's answer is 100% correct, but probably not very understandable to you. First, as mentioned several times in the comments, the mark is not put into the ethernet packet on the wire. So if you ping server B from server A, server B will not ever be able to detect the mark. If you want to do anything, you'll have to use server A alone. So, ...


2

Try: cp /usr/share/backgrounds/*.jpg /week/pictures/final/jpg/ 2> cp.err Note that the cp.err file will be created in the directory where you are when you run the command. If you want the error file in a differente directory, you can do: cp /usr/share/backgrounds/*.jpg /week/pictures/final/jpg/ 2> /desired_directory/cp.err


2

Instead of reading hoption, rspid and rspname from stdin while the script is running, you should take them as options on the command line, just like most other programs do. This sounds difficult, but is actually quite easy using the bash-builtin getopts (see help getopts for a summary) That way you can easily test your script with the same args just by ...


1

You can try using this command, which is distribution-independent: ldconfig -p This gives a full list of the libraries installed. If you pipe it to less, you will be able to scroll up or down: ldconfig -p | less


1

Maybe your SSD does not support this queue depth? # hdparm -I /dev/sda /dev/sda: ATA device, with non-removable media Model Number: M4-CT064M4SSD2 [...] Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Alternatively, try with 1, 2, 3, ... to find the maximum queue depth the kernel will allow you to ...


1

Your fonts and colors would be determined by the type of terminal emulator and where it is run. Some people do something like ssh -X remotehost -e xterm and some do this ssh (running in a terminal on the local host). Technically the local X display determines the maximum number of colors which you can use (in either case), but most users have ...


1

Add a debug line of echo ${hoption} after it reads it in to confirm it is being set correctly. Also put an echo in each case indicating you've reached that case. In this case since you are only looking for a single character, I would use read in this way: read -r -n 1 hoption The -n 1 flag tells read to only wait for 1 character and not wait for a new ...


1

TestDisk is the way to go. Read https://help.ubuntu.com/community/DataRecovery and follow the steps. If you can, use a different computer to browse and ask for advice and stop using your machine. Normal use of your computer can overwrite the data that you are trying to recover.


1

You are most likely after: ffmpeg -i "A_File.mp4" -ss 00:00:0.0 -t 10 -an "B_File.mp4" To do it a bit faster you can also try adding -threads $(nproc) eg: ffmpeg -threads $(nproc) -i "A_File.mp4" -ss 00:00:0.0 -t 10 -an "B_File.mp4" There is already a substantial number of articles and documentation on achieving these results including: ...



Only top voted, non community-wiki answers of a minimum length are eligible