Solaris
   12 tags on

Solaris

  • All Sites

1 answer

How to replace the words with certain pattern in a file with sed?

I know how to replace a word with sed. Using sed -i 's/[old_text]\b/[new_text]/g' could replace old_text with new_text. What I want to do is to replace nchar(10) or nchar (10) or nchar ( 10)... …

22 mins ago
0 answers

ZPOOL replace defect device in exported pool

Yesterday, I put a new disk into my server. Sadly, I didn't check the disk before of failures. I added it to my pool with the command zpool add nas ...

23 mins ago
0 answers

How to setup DreamPie to mimic Django's “manage.py shell” functionality

I would like to use DreamPie, a python shell, as a CLI that functions the same way that manage.py shell works. Additionally, it would be very nice to have some way to automatically run some code when …

1 answer

understanding socket recv behaviour

I'm reading the manpage for recv http://linux.die.net/man/2/recv , but it doesn't really answer the questions I have, so I hope I can get some answers here. I call recv this way: numBytes = ...

59 mins ago
3 answers

Dynamically trim stdout line width in Bash

Lately, I have been experimenting with the ps command, and sometimes long paths wrap to the next line (or two) and make it hard to read. I want to pipe the ps output into another program to limit the …

1 hour ago
2 answers

Send commands from command line to a running Python script in Unix

I want to build an script that can be controlled when it is running using another scripts. For example I want to run my script like this: ~: Server & and be able to run one of it's functions …

3 answers

Obtaining Ids from two columns using awk

Below is my sample file (Two columns separated by tab): A:Q08465 "\t" B-60323N B-60323N "\t" A:P38806 A:P50947 "\t" B-60323N A:P54784 "\t" A:P29469 A:P29469 "\t" A:P32833 A:P29469 "\t" A:P50874 …

1 hour ago
0 answers

Shell Command not executing from Codeigniter

I am trying to run below code for executing shell Command from codeigniter Controller Method But it s not working. function Stopapplication(){ shell_exec('/tmp/stop'); ...

1 answer

Executing multiple line shell command in php

I'm trying to execute a shell command from php using the exec command The following command works echo exec('whoami'); but I need to execute the following shell command cat > ...

1 hour ago
4 answers

In sed or awk, how do I handle record separators which *may* span multiple lines?

My log file is: Wed Nov 12 blah blah blah blah cat1 Wed Nov 12 blah blah blah blah Wed Nov 12 blah blah blah blah Wed Nov 12 blah blah blah blah cat2 more blah blah even more blah blah …

1 hour ago
0 answers

Tmux create window failed: index in use: 0

I have a script like so that I'd like to create a tmux session with windows with various server connections: tmux new-session -d -s server-connections tmux new-window -t server-connections:0 -n ...

1 hour ago
1 answer

How can I do bash 'set -e', 'set -u' and 'set -x' in fish?

I suppose for set -e I could trap signals, but the others I have no clue.

2 hours ago
1 answer

Scheduling a shell script in cron doesnot produces required output

I have a shell script that I have scheduled using cron using a command: 0 10 * * * /directory/Script.sh > /directory/log/output.log The script is scheduled to run at 10 AM everyday. The script …

2 hours ago
5 answers

What does exit 99 means?

I'm new to Unix. Just want to know what is exit 99 and why would one use it and what are the significance uses of it. For example, I'm using exit 99.

2 hours ago
1 answer

How to get a list of recently changed files for a directory and all its subdirectories?

In Linux I know a command to find and list the latest modified files in a directory with all its subdirectories which would be find /var/www/ -type f -exec stat --format '%Y :%y %n' {} \; | sort -nr | …

3 answers

how to expand variables within a variable in Shell

I got stuck at a problem where I need to expand a variable in another variable as follow : var1=abc var2=$var1/pqr echo ${!var2} Here I want output to be abc/pqr , but not getting it , please help. …

3 hours ago
0 answers

Increasing the size of a filesystem in AIX - chfs and df commands

the command df / displays the following output on my host. Filesystem 512-blocks Free %Used Iused %Iused Mounted on /dev/hd4 5177344 1065096 80% 13676 9% / according …

3 hours ago
1 answer

How to go into a directory from an archive using the terminal?

Like I use cd to go into a normal directory, how to cd into a directory from an archive (compressed file, such as .zip, .tar.gz, etc.) and see its content using the terminal? Is this possible?

0 answers

How to get all the files for a given extension in a direcotry including nesting directories with html 5 file system?

I'm building an application with PhoneGap/Cordova and AngularJS and stuck with the file system. Say I have a directory which has many nesting sub directories. Now I need to get all the json files ...

2 answers

Need command to find the dat files in a directory

Can anyone help us in writing a command in shell script to find the files with .dat extension and which are lagging for 60 mins from current time. This script wil schedules to run for every 30mins.

3 hours ago
4 answers

How to get video duration in seconds?

How can I get video duration in seconds? what I've tried: ffmpeg -i file.flv 2>&1 | grep "Duration" Duration: 00:39:43.08, start: 0.040000, bitrate: 386 kb/s mediainfo file.flv | grep …

3 hours ago
0 answers

Detecting Unix home in Wine application

My Windows application is frequently used on *nix using Wine. As it is a file-centric application, it frequently uses (and presents to an user) Windows "documents" folder (as resolved using ...

3 hours ago
4 answers

How to shorten name of a long list | Any command of [[ bash ]]

Good day, I was wondering how to shorten a long list of different names, to make it readable. List: (Suppose there are all different) simon, gaurent simon, gaurent simon, gaurent simon, gaurent ...

3 hours ago
1 answer

Input redirection - if open file for write failed

I implement a simple shell in linux (c language). I checked in the terminal this line: ./myprogram < a.txt when I haven't any permissions to a.txt. That such the myprogram was run with empty ...

3 hours ago
2 answers

How to schedule a shell script in Linux centos?

I have a script that I need to schedule on daily basis. How can I schedule a script in centos. Like I want to run that script everyday at 10 AM and can I store the output of the script in a log file. …

4 hours ago
1 answer

Understanding how to connect pipes and wait for them in a custom C shell

EDIT Changed title as the problem is no long just how to connect them, but also how to wait for them. Update I solved the problem, and have update my wait handling code below to reflect what is now …

4 hours ago
1 answer

How to delete a line by passing line number as variable

Good day, I want to delete a line of a document by passing the number as variable. ERR=`set of bash commands` ; sed '${ERR}d' file Thaks so much for any clue

4 hours ago
3 answers

how to use any bash command to cut a file and save all columns in a different file

Good day, I was wondering how to cut a file and save each part in a different file. Where the delimiter is ] example: TOfile1 ] TOfile2 Thanks in advance

4 hours ago
4 answers

Calculate all differences between adjacent columns

I have data like this in a file as shown below 60.5(r) 426.5(f) 810.5(r) 1176.5(f) 1560.5(r) 1926.5(f) 2310.5(r) 2676.5(f) 3060.5(r) 3426.5(f) 3810.5(r) 4176.5(f) 4560.5(r) 4926.5(f) 5310.5(r) ...

4 hours ago
6 answers

How to set a BASH variable equal to the output from a command?

I am working on a simple scripting project for work that involves the use of BASH. I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" VAR2="$2" MOREF='sudo …

15 30 50 per page
1 2 3