New answers tagged

-1

grep file1.txt file2.txt -e expr has grep opening the files itself, so -H will still work.


0

pfiles <pid> can list the full path to the executable. Example: Snippet from UNIX95=1 ps -efo pid,comm 1666 cimprovagt Now lets run pfiles 1666 1666: /opt/wbem/lbin/cimprovagt 0: S_ISCHR mode:666 dev:64,3 ino:124 uid:2 gid:2 rdev:3,2 flags = O_RDONLY|O_LARGEFILE file = /dev/null The first line shows the full path to ...


2

Perl to the rescue: echo one-two-three-four-five | perl -pe 's/-(.)/\u$1/g' \u upcases the following character.


0

As for the actual "why" bit — Historically, a teletypewriter used Carriage Return (hex 0D) to move the print head to the left margin, followed by a Line Feed (hex 0A) to advance the paper. Commodore, Atari, and (pre-Unix) Apple kept the Carriage Return as their line-ending symbol; Unix kept the Line Feed; and CP/M / DOS kept both. Many Internet protocols (...


4

If you opened the text files in hex editor, the difference you would see at the end of a line would be the following: Windows Line Endings: 0x0D 0x0A Unix Line Endings: 0x0A The 0x0D is the hex value for the carriage return (represented textually simply as \r). The 0x0A is the hex value for the new line character (represented textually simply as \n). ...


2

Windows uses a carriage return followed by a newline. Unix just uses a newline. So that's one extra byte per line break.


0

The easiest way is probably to use the mdls command. mdls lists the metadata attributes for a specified file. Here is a sample output for a .png file I have on my Desktop $ mdls ~/Desktop/hipchat.png _kMDItemOwnerUserID = 205009058 _kTimeMachineIsCreationMarker = 1 _kTimeMachineNewestSnapshot = 4001-01-01 00:00:00 +0000 ...


2

There is a syntax error in sort -k2, 2 filename There should not be a space delimiter in the -k2,2 option. In addition it would eliminate a possible source of confusion and/or error (depending on the contents of the file which is being sorted) to add either a dictionary order or a numeric sort option to the command in order to make it explicit how things ...


0

We can string a few commands together to do it. I'm going to have this example write the renamed files to another directory, they can be moved where you like, but I personally like to keep them separate in case I have a few false starts. mkdir renamed for recovered in recup_dir.89/*xls; do new_name=$(date +'%b-%d-%Y' -d "$(file "$recovered"| grep -Po '...


1

Well you can put files anywhere long as things can access them properly, however cluttered filesystems are a headache if someone comes in later. /srv is most logical plus if you follow Filesystem Hierarchy Standard it would go here. If you do multiple domains you can do /srv/domain1 /srv/domain2 etc etc then subfolder out inside there /ftp /www /tftp /logs ...


1

There are lots of ways you can do this, but how about tr -d "\r" < input.file > output.file "tr" translates characters - in this case we use the -d switch to delete rather then replace characters, and then specify to delete the "cr" character. As tr operates using stdin and stdout, we use redirections to efficiently create a file with the new data.


1

Worth to mention the NCurses Disk Usage shell command. Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a remote server where you don't have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to ...


3

Depends on what Linux distro you are using. Typically, you can force reinstall a package, and hence, get back all its files. For example, in a Debian based system, like Ubuntu, you'll see: dpkg -S /bin/ls "ls" belongs to "coreutils". Therefore, force reinstall the package: sudo apt-get --reinstall install coreutils And, your accident will be fixed!


0

One thing that is not immediately apparent to most new samba/SMB admins, is that Share permissions stack on top of disk permissions. Share permissions only affect Samba/WFPS access; they do not override permissions on the shared directory, only augment them. So, if a folder is owned by user1:user1 and has permissions of 770, and then shared to allow ...


1

I'm sure this could be improved, but I have a sed solution for one-digit numbers: h; # put count in holding space s/9/8 9/ # replace 9 with 8 9 s/8/7 8/ # and so on ... s/7/6 7/ # ensuring that the pattern space s/6/5 6/ # ends up as 1 ... n s/5/4 5/ s/4/3 4/ s/3/2 3/ s/2/1 2/ p # print pattern space x # exchange pattern and hold space /9/{s/9/8/;x;p;x} # ...


0

I assume, you've already read the manual of sed and everything you could get from the net on the topic a couple of times, you just can't see the items that are important to you now. Let's emphasize them first of all, regular expressions (at least the simplest ones), that is regexp s/regexp/string/ \(subregexp\) inside regexp & inside the string element ...


0

Try sed -n '$i\ #######RAJASEKHAR#####Modified for DSD######\ #* soft nproc 1024\ * soft nproc 2048\ root soft nproc unlimited' old_file > new_file


-1

According to Ubuntu documentation for LD_LIBRARY_PATH: You must use /etc/ld.so.conf.d/*.conf configuration files Then: Add a ld.so configuration file in /etc/ld.so.conf.d/ with the path of your LD_LIBRARY_PATH Update the cache with: sudo ldconfig -v


0

Did you try something like this?


0

This answer from the Reddit thread saved me: It's probably RVM preventing the exit "hook" for bash_sessions to run. If you comment out the following line in your .bash_profile, it should work. [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"


0

You have four .biz files. Therefore for f in *.biz; do ... done will form a loop that iterates four times. $f be assigned values minimum.biz in 1st iteration, maximum.biz in 2nd iteration, milan.biz in 3rd iteration and ritz.biz in 4th iteration respectively. Inside the loop, i.e. file="$(ls *.biz)" echo " $file" $file is assigned the four file names, ...


0

Changing the PCIe slot, then swapping out the USB 3.0 card with the exact same model did not help. I then tried disabling the on-board USB (2.0), and this resolved my issue. There appears to be a conflict with USB 2.0 and USB 3.0 with FreeBSD.


1

It was probably doable with the other answers provided but, as I was looking for something pretty simple, I did this, which is working perfect: #!/bin/bash # First position will always be (1,0), let's set it. x=1 y=0 # Variables that control wether we have to do a '+1' for $y sum="no" ftime="yes" # For loop to check how the script would work. # The final ...


0

Honestly, the best tool is Google's gsutil. It handles parallel copies with directory recursion. Most of the other methods I've seen can't handle directory recursion. They don't specifically mention local filesystem to local filesystem copies in their docs, but it works like a charm. It's another binary to install, but probably one you might already run ...


1

Perl: #!/usr/bin/perl my @coords = ( [1, 1.1], # coordinate 1, format x, y, first element has index 0 [2, 2.2] # coordinate 2 ); print "point 1: coord x=". $coords[0][0]."\n"; print "point 1: coord y=". $coords[0][1]."\n\n"; # change y for coord 2 $coords[1][1] = 10; print "point 2: coord x=". $coords[1][0]."\n"; print "point ...



Top 50 recent answers are included