12 tags on


  • All Sites

1 answer

Remote shell in Jenkins seems to change my script when it runs

We are transitioning to Jenkins from using Unix build scripts. Things are moving along but I'm stuck when I try to copy and rename 2 'artifacts' on the build host. My command in Remote shell is: ...

1 answers | 8 secs ago by brian on Stack Overflow
4 answers

How to show only the last k columns in ls -l?

I like to restrict the columns shown in ls -l command, by eliminating the first 4 columns. ls -lh shows: drwxr-sr-x 20 gamma alpha 4.0K May 22 13:18 Desktop drwxr-sr-x 3 gamma alpha 22 Oct 6 ...

4 answers | 4 mins ago by LoMaPh on Unix & Linux
0 answers

Best way to increment numbers in one line in Linux

I have one line with lot of entries among which is also time. ('DEFAULT',17,NULL,'2014-07-14 10:30:00','Something','2014-07-14 06:30:00',1),('DEFAULT',26,NULL,'2014-07-14 ...

1 answer

Invoking awk from Java

I have a Java application which invokes a certain awk script. I use runtime.exec() to start the awk script process and I read from its InputStream and everything is OK. However, at some point this ...

1 answers | 13 mins ago by slouc on Stack Overflow
0 answers

Bash - assign to an array the out put of a variable | grep “abcd” -c

I am new to bash script and I would like to assign to an array the output of a variable using grep "abcd" -c. Here is my code: for .... do disUser[$i]= "$VAR" | grep "abcd" -c echo "disuser $i" ...

2 answers

Copy .txt files in a certain directory

I have an issue in copying my file in my directories. I have .txt and .jpeg files in a lot of directories, and I want to copy only the .txt files according to the directory. For example, I have this: ...

2 answers

How to enlarge RAID5 array with MegaRAID WebBIOS?

I'm a little confused with RAID5. I created a RAID5 array group from WebBIOS with 6 drives. Then created an XFS partition on this RAID5 drive. How can I enlarge the RAID5 without losing data? In ...

2 answers | 43 mins ago by rkvmyizs on Super User
3 answers

default separator for awk on Linux

Sorry for this stupid question, searched but not confident is the right answer is found, so the default separator is only space for awk?

3 answers | 1 hour ago by Lin Ma on Stack Overflow
25 answers

Check whether a file exists using Python

How do I check whether a file exists, using Python, without using a try statement?

25 answers | 1 hour ago by spence91 on Stack Overflow
0 answers

why are zfs on linux transfer rtates reported incorrectly after expanding array?

I have upgraded the drives in a 4 drive Raidz array in a NAS server and the array has auto expanded to the new size. In testing transfer rates from the NAS server now I observe that when performing ...

3 answers

How to print first four characters of first and last filenames in a directory

There are plenty of files in a directory. I would like to print first four characters of first and last filename in that directory. Suppose the files are in a directory as test101.dat test102.dat ...

3 answers | 1 hour ago by Mano on Stack Overflow
1 answer

Run two shell commands

What would be the correct format for the following, where I want to execute two scripts? The following is only executing the first one for me: if ps aux | grep -E ...

1 answers | 1 hour ago by David542 on Stack Overflow
0 answers

BTRFS - removing drive by devid instead of path

I recently lost a 5 TB drive using btrfs. I had a system freeze (unsure why) while a balance was running. My SMR drive got corrupted. I was able to mount my array degraded and balance my data. ...

4 answers

How to pass variable to shell command in C?

For example, I code : fp = popen("wc -l < myfile", "r"); But myfile should be any file's name which is parsed to this project. It could be file abc.txt or 123.txt or xy.txt etc. Then I want to ...

4 answers | 1 hour ago by beasone on Stack Overflow
1 answer

Shell script problems: how to parse a special “word” out of a line of xml file

i need really your help. I have a xml-log file, which content information, that i have to parse. Such xml file: <?xml version="1.0" encoding="UTF-8"?> <results> <error ...

1 answers | 1 hour ago by Lama Dingo on Stack Overflow
1 answer

Change Folder/File Permissions for HIDDEN Subdirectories

This question is very similar to Change Folder & File Permissions for all Subdirectories , which worked for me completely when the folders weren't hidden. However, I have a hidden folder (call it ...

1 answer

How to maintain a counter across multiple executions of a script?

I have a script with a conditional statement and I want to find out how many times the then clause is executed, across multiple runs of the same script. eg: if [condition] then Some code; ...

1 answers | 2 hours ago by Eka on Ask Ubuntu
3 answers

What vegetables will grow well in limited sunlight?

Our backyard receives limited sunlight due to three massive trees in a small area. There is only about 2 hours of direct sunlight per day to my vegetable patch. Could I get some suggestions for ...

1 answer

setting up cron Job from bash is giving errors

I am trying to set up a cron Job in a remote server using a bash script.The command is as follows: ssh $NODE_USER@$NODE_HOST "cat <(crontab -l) <(echo "33 03 * * 0-6 ...

1 answers | 2 hours ago by user1958962 on Stack Overflow
1 answer

Compare two files having different column numbers and print the requirement to a new file if condition satisfies

I have two files with more than 10000 rows: File1 has 1 col File2 has 4 col 23 23 88 90 0 34 43 74 58 5 43 54 87 52 3 54 ...

1 answers | 3 hours ago by Roselover on Stack Overflow
1 answer

UNIX Shell Script Solution for formatting a pipe-delimited, segmented file

The input file has up to 34 different record types within the same line. The file is pipe-delimited, and each record type is separated by '~' (except for the originating record type. Not all 34 ...

1 answers | 3 hours ago by H Mullins on Stack Overflow
1 answer

Why can't “sudo cp” find the files?

Who can give me a logical explanation to this issue: I can not run this command: sudo cp /data/*20150522* /backup/ cp: cannot stat `/data/*20150522*': No such file or directory And when i switch ...

1 answers | 3 hours ago by IMAnis_tn on Super User
4 answers

Effectively handling 2+ million files

I have a file based DB that has about 2M files stored in 3 levels of subdirectories. 2/2/6253 2/2/6252 ... File a vary from 30 bytes to 60 KB. Whole DB is Read Only. DB is about 125 Gigabytes big. ...

4 answers

remove a string between columns

I am trying to remove text between two strings but keep all the data before and after the pattern. Example text that I am working with: comp117_c0_seq1 len=214 path=[173:0-52 372:53-71 226:72-213] ...

4 answers | 3 hours ago by djfreeze on Stack Overflow
2 answers

Python system argument reading '&'

I want to pass url to my python via the console and then do the appropriate tasks. many of the links contain the character '&' in the link. python interprets that as ending the argument this ...

3 answers

Avoiding expansion when looping: for x in $foo

I have to count the number of executables in a directory. I've already figured out a different way to do it (by writing to a file and then searching the file, but that is kind of ugly). The solution ...

4 answers

Tokenize and capture with sed

Suppose we have a string like "dir1|file1|dir2|file2" and would like to turn it into "-f dir1/file1 -f dir2/file2" Is there an elegant way to do this with sed or awk for a general case of n > 2? My ...

4 answers | 3 hours ago by Ivan P. on Stack Overflow
0 answers

Shell script in php web page issue

I run via php web page hive quaery inside shell script.But don't run correctly bash script on apache2. php file: $select="select text from tweets limit 5";//shell argument 1 $id="2"; ...

0 answers

Unknown filesystem type 'LVM2_member'

I use to have 2 x 500GB drives merged using LVM as one drive. One of the drives is managed and removed from the server and the LVM is corrupted I tried to mount the second HDD but it's not working ...

2 answers

How to count the number of consecutive occurences of nonzeros along all directions of rows and columns (but not diagonaly) in a Matrix

I am trying to count the number of consecutive occurences of nonzeros along all directions of rows and columns (but no diagonaly) in a matrix. e.g., my matrix is: 1 1 1 0 0 2 2 0 2 1 1 1 1 0 ...

2 answers | 4 hours ago by Mano on Stack Overflow
15 30 50 per page
1 2 3