12 tags on


  • All Sites

2 answers

How to add “wrappers” around methods in source code based on a pattern, using sed, awk, grep and friends

How can I add wrappers to a file based on a pattern? For instance I have the following: ... find(css_policy_form_stage3).click with_ajax_wait expect(css_coverage_type_everquote).to ...

0 answers

UNIX Comparing string with space from command output

I have a delimited flat file and I want to find the column position of a user given header. The problem is some of my headers have spaces in them, and when I do a comparison it treats the string of ...

3 answers

Handling NULL characters in shell

Is there a portable way of handling NULL characters in shell? A typical example would be splitting the output of find ... -print0 with shell (and shell only) either in a pipe or in a command ...

3 answers | 19 mins ago by peterph on Unix & Linux
0 answers

How can I list all vhosts in nginx

Is there a command that will list all vhosts or servers running under nginx on CentOS? I would like to pipe the results to a text file for reporting purposes. I'm looking for something similar to ...

0 answers

Getting the battery level of a Bluetooth headset on Mac OSX

I would like to know if it is possible to get the battery level of a connected Bluetooth device (for example, a headset) on Mac OSX. I'm looking for a command line or a library that would offer this ...

0 answers

How to make the up and down arrow keys show history entries in a script using zsh?

As shown in this answer, it's possible to use read with Readline (-e) in bash to return previous history items by using the up and down keys: #! /usr/bin/env bash while IFS="" read -p "input> " ...

1 answer

How to get my cron job to output its exit code to a file

The cron job I am trying to implement is: 0 1 * * * /Users/kfchicken2go/Cron_Job Cron_Job is: SHELL=/bin/zsh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin brew ...

1 answers | 31 mins ago by K.M. Frankel on Stack Overflow
4 answers

Running a .bat script under Cygwin bash

I would like to use an existing DOS/Windows .bat script under a Cygwin bash shell. The .bat script creates a number of variables which need to exist after the .bat script ends. This works, but the ...

4 answers | 41 mins ago by Paul on Stack Overflow
1 answer

HYPER-V Cluster W2012R2 Can't delete VHDX on CSV

I'm working on a Windows 2012 R2 Hyper-v. I've just done an EXPORT of a Virtual Machine to a CSV Volume to import later. But I hanve't performed the import, and when I went to delete the exported ...

3 answers

What if I don't want to do anything in a if-then block but something in its else block?

#intro if [ -n "$1" ] then echo 666 else echo 555 fi exit; Actually I do want to echo 555 while I don't want to do anything in the first block, what should I do? I noticed ...

3 answers | 54 mins ago by Aw Qirui Guo on Unix & Linux
2 answers

Hide Soft Keyboard using adb

I want to hide soft keyboard using adb shell command. Is there any specific command available to do so or In any ways can I get the current focus window object over adb on which I can hide the ...

1 answer

Deleted $WORK Directory

So I made a mistake working on a school assignment and I'm curious what exactly it is that I did. I used ssh to log in to a supercomputer provided for the class and used scp to copy a file to my ...

2 answers

Is it possible to transfer file from a Linux bash script to Windows without mounting the server folder?

I am writing a script (bash) to transfer files from my local linux machine to Windows servers. The Windows servers are accessible normally using the SAMBA shares and I am able to mount a folder to my ...

2 answers | 1 hour ago by ruffp on Unix & Linux
6 answers

Is there an easy way to determine if user input is an integer in bash?

I am a new student to bash scripting, and I am stumped on an assignment question. I was wondering if there is an easy way to determine whether a users' input is an integer or not. More specifically, ...

6 answers | 1 hour ago by mrwienerdog on Stack Overflow
3 answers

How do I check if a given parameter is in an given array?

I have a shell script like this: names=( jack john jerry) And I want the user to type any of these three names as its first parameter, just like: ./ jack If the user typed a ...

3 answers | 1 hour ago by Aw Qirui Guo on Unix & Linux
2 answers

renaming files using adb shell

I want to rename a file on my android device (running CyanogenMod 11) using the adb shell. I have access to the phone via adb, but when I go to the directory where the file is located and try to ...

2 answers | 1 hour ago by fukurai on Stack Overflow
8 answers

How to print lines with blank 5th field in CSV

I have to check if the fifth field is empty in a CSV file. This is my file: 1,abc,543,87,DATA,fsg; 1,abc,543,87,,fsg; 1,abc,543,87,DATA,fsg; 1,abc,543,88,,fsg; 1,abc,543,,DATA,fsg; As you can ...

8 answers

What is the purpose of the : (colon) GNU Bash builtin?

What is the purpose of a command that does nothing, being little more than a comment leader, but is actually a shell builtin in and of itself? It's slower than inserting a comment into your scripts ...

4 answers

What is sed and what is it used for?

I've been seeing a lot of sed lately, and I find it to be a rather confusing command. The manpages weren't particularly helpful, but I do know that it can be used for parsing the output of other ...

4 answers | 2 hours ago by Seth on Ask Ubuntu
1 answer

Please tell me what dose 1) -n option 2) sed 's?.*/??'

if [ -n "$FULL" ]; then INSTALL_LIST=`cat $LIBLIST | sed 's?.*/??'` else INSTALL_LIST=`ls -d *lib*/[0-9]*.[0-9][0-9] | sed 's?/.*??' | sort -u` fi

1 answers | 2 hours ago by I. Eduard on Stack Overflow
2 answers

how to echo $, & symbols correctly?

It'd be a very stupid question but I failed with some existed answers. what I need is very simple: out put &a on the screen while there is already a defined variable a. Here is what happened in ...

2 answers | 2 hours ago by Aw Qirui Guo on Unix & Linux
0 answers

Something similar to inotifywait, without being able to install inotifywait

I wanted to continuously re-build and test projects, but just discovered my school's RHEL distribution doesn't come with inotify or inotifywait. Are there any alternatives I could use, which would ...

0 answers

fs_usage: a part of stdout is missing.. Where did it go?

I'm using $ fs_usage -f diskio to spy on processus when I hear my hard drive spinning for no reason, so that I know who is working so hard.. Here is one sample line: 16:14:13.785568 ...

2 answers

Search, Match & Count from input file: Script

I have an input file like this John completed his graduation John is working for an IT industry Thomas completed his graduation John completed his graduation Thomas is working for an IT industry ...

2 answers | 2 hours ago by Kishore on Stack Overflow
3 answers

Insert changing string from filename at the beginning of every line in terminal

I have zero experience with bash so I'm struggling with the syntax - I gave up attempting in python as I thought that it might be easier. I would like to extract part of the filename (before the .xyz ...

3 answers | 2 hours ago by AnnaG on Stack Overflow
0 answers

What does this terminal message mean?

I can't get internet on one of my computers. It says connected. I had this similar problem on my other computer and I used this command to fix it: ip route add default via defaultgatewayip It ...

1 answer

PHP: how to get IP of specific VLAN

background: a page should display SNMP data from various devices in a mgmt vlan, to loop through all ips in the network, i need to know the ip/network, the interface is on. in bash this works ...

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

Multiple string grep must output the filename:target string:count in linux

I wanted to grep for strings "Manager" and "DBA" in all file at current directory and provide the output as filename:Target string:count

1 answers | 2 hours ago by K.K. on Stack Overflow
5 answers

Parse huge file shell ( or other scripting language )

I am trying to parse a huge file ( arround 13 GB ) and transpose it in a csv ( can also transpose it in two or three ). The file has the records on one line that is why it has arround 500.000.000 ...

6 answers

Why does [A-Z] match lowercase letters in bash?

In all shells I am aware of, rm [A-Z]* removes all files that start with an uppercase letter, but with bash this removes all files that start with a letter. As this problem exists on Linux and ...

15 30 50 per page
1 2 3