Skip to content
Advertisement

Tag: unix

cd command : how to go back an unknown number of levels from current subdirectory to a particular parent directory (unix and dos)

Ok, so I am trying to resolve a uri in an xmlcatalog and I want to go back from a particular sub-directory back to a parent-directory that is an-unknown-number-of-levels behind. eg: file:///D:/Sahil/WorkSpaces1/Cartridges1/Project1/ParticularFolder/Level1/Level2/<so-many-levels>/CurrentFolder I want to go back from “CurrentFolder” to “ParticularFolder” without typing in the full FilePath. I want to achieve this because, I work in multiple Projects which all

Bash sort ignore first 5 lines

I’m having trouble ignoring the first 5 lines of my file while sorting the rest. My current command sorts the entire file by the second item, however I need to skip the first 5 “header” lines. I need read it and write it to the same file. Current Command Example Answer This sorts lines 6 and after of the file

How to print a binary value(1010) into decimal value(10) in GDB?

I want to print the decimal value of 1010 in gdb, but it prints the result as it is what I gave last. Answer GDB’s p[rint] command prints the value of the expression you provide, which is interpreted in the source language of the program being debugged. In C, your 1010 is a decimal literal, not a binary literal, so

How to delete numbers, dashes and underscores in the beginning of a file name

I have thousands of mp3 files but all with unusual file names such as 1-2songone.mp3, 2songtwo.mp3, 2_2_3_songthree.mp3. I want to remove all the numbers, dashes and underscores in the beginning of these files and get the result: Answer This can be done using extended globbing: This uses parameter expansion: ${fname##pattern} removes the longest possible match from the beginning of fname.

How to get CPU Utilization number from top?

How would I get the number for CPU Utilization from running the top command on a specific user? Answer Pipe top to awk and add up the CPU utilization column: That awk command says “For rows (from top) greater than row 7, add up the number in field 9 $9 and store it in variable sum. Once you have gone

Advertisement