Skip to content

Tag: unix

searching through text file in terminal

Hi this might be a basic question for many, but it has however managed to eat a couple of hours of my time. I have large data file as an output from running a script. The file contains around 15 columns and around 100,000 rows. I wish to search through the file and in columns 4,5,6,7 and 8 check for

Difference on bash and ash parentheses

I was trying to use a diff command for comparing directory listings which works fine in bash: However, on the ash (embedded device where no other shell is available) I get Is there any difference regarding reading input operator < or parentheses ( )? Answer Don’t confuse the angle bracket in <( … ) with the one in redirections like

Bash : Syntax Error Near Unexpected Token `’table_name’`

I’m getting started learning Laravel 5 in Ubuntu 15.04. So, I’m done creating my database but when I’m trying to insert data using Terminal, I’ve got some error that says Here’s my terminal inputs in my laravel app directory It’s just an simple queries on adding datas inside my database but I can’t get through this thing. Is there any

command blkid don’t show my partitions UUID

I’m using Ubuntu. command blkid or blk /dev/sda2 in LPIC-1 module 104.3 (mounting and unmounting). but these commands don’t show me the expected results. blkid is installed and also I can see man blkid !!! Could you guide me to fix this? Answer Run sudo blkid After that you will be able to get the same result with simply running

How to abort if command fails in Unix shell?

I’m not very great with shell scripting and still couldn’t find a solution to this. I want to run a command gulp tslint and if it returns errors, abort the script. So far I tried gulp tslint || exit 1 with no success. I think it somehow is returning true, even though it has errors when i run it on

Validating file records shell script

I have a file with content as follows and want to validate the content as 1.I have entries of rec$NUM and this field should be repeated 7 times only. for example I have rec1.any_attribute this rec1 should come only 7 times in whole file. 2.I need validating script for this. If records for rec$NUM are less than 7 or Greater

escape alarm() process timeout with nohup or setsid?

I have a monitoring application, Zabbix agent, that allows me to run arbitrary commands/scripts and grab the return value. The agent is configured with a timeout and any command that exceeds the timeout will be killed. For every command that is run, it first sets the timeout via alarm(timeout) and then forks the agent process before running the command in

How does netstat determine symbolic hostname?

I was trying to understand what the –numeric/-n flag of netstat does? Manual says the following about –numeric/-n –numeric , -n Show numerical addresses instead of trying to determine symbolic host, port or user names. Following is a line of output with “-n” option Following is the same line as in A but without “-n” option port 8080 in my

how to execute init scripts from the command line using ssh

Above mentioned code works fine and displays all the contents of the test directory folder but this code fails It does not start the mysql server, I have login in to server and use the same command to start the mysql server Can any one explain this behaviour ? what I am doing wrong bit puzzled 🙁 Answer Do something