Sponsored Content
Full Discussion: How to alias this awk?
Top Forums UNIX for Dummies Questions & Answers How to alias this awk? Post 302966178 by RudiC on Tuesday 9th of February 2016 04:27:55 AM
Old 02-09-2016
Please be aware that RavinderSingh13's proposal reflects the situation at login. No development during the session could be monitored.

---------- Post updated at 10:27 ---------- Previous update was at 10:20 ----------

Try escaping certain meta chars:
Code:
alias DF="df -k /tmp | awk 'NR==1 {CNV=1024*1024;GBYTES=\"GBytes\";FMT=\"%-35s %-10s %-10s %-10s %10s %-s\n\"; printf FMT, \$1, GBYTES, \$3, \$4, \$5, \$6; next} {printf FMT,\$1,\$2/CNV,\$3/CNV,\$4/CNV,\$5,\$6}'"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Define an alias with an embeded awk command ??

Hi all, I'm trying to define an alias with an embeded awk command: alias kpipe='kill `psme| grep "ifw -r" | grep -v "grep ifw -r"| awk '{print $2}'`' The problem is that the awk command (awk '{print $2}') contains two ' ..' quotes. So bash assumes that the first awk quote corresponds to... (5 Replies)
Discussion started by: jfortes
5 Replies

2. Shell Programming and Scripting

awk alias

Good morning I would like kindly to ask you to help me with creation of alias with awk command. alias a="awk {print $1 "| " $2 "| " $3 "| " $4 "| " $5 "| " $6 "| " $7 "| " $8 "| " $13 "| " }" there is some error but I don't find it please explain me what is error and how can be avoid... (1 Reply)
Discussion started by: papa1980
1 Replies

3. UNIX for Dummies Questions & Answers

How to create alias with awk command

Good morning I would like kindly to ask you to help me with creation of alias with awk command. alias a="awk {print $1 "| " $2 "| " $3 "| " $4 "| " $5 "| " $6 "| " $7 "| " $8 "| " $13 "| " }" there is some error but I don't find it please explain me what is error and how can be avoid... (5 Replies)
Discussion started by: papa1980
5 Replies

4. Shell Programming and Scripting

AWK alias with parameters

Hello, How can I make an alias of an AWK one liner that prints specific lines from a file like below? # from a command like this: awk 'NR == 100, NR == 150' file.cfg The alias I want to make should work like this(I guess): <alias_command> <file.cfg><start_line><end_line> So the... (1 Reply)
Discussion started by: majormark
1 Replies

5. Shell Programming and Scripting

Alias to awk BEGIN statement

I'd like to define an alias to awk's begin statement since I use awk with different delimiters all the time and it is tiresome to type awk '{OFS="\t";FS="\t"}{BLAH BLAH}' every time. The problem is that bash won't let me make an alias with an open quote, which is necessary for the BEGIN alias to... (3 Replies)
Discussion started by: baconbasher
3 Replies

6. Shell Programming and Scripting

How to alias an awk command with single and double quotes?

Hi, I am trying to write the following command as an alias in my .bashrc file. bjobs -u all | awk '{if (NR > 1) {username++;}}END{{print"\nJOBS BY USER:\n"} for (i in username) {print username,i;}{print"\n Total Jobs=",NR-1,"\n" }}' The command simply puts how many jobs each user is... (2 Replies)
Discussion started by: jacekmaciek
2 Replies

7. UNIX for Dummies Questions & Answers

using alias

I need to login to one server and then switch the user and set a number alias. But i cant modify the .profile file. I have one script avi1.sh $ more avi.sh sudo su - bil sh avi1.sh and in home directory of bil i have avi1.sh that says $ more avi1.sh alias l='ls -ltr' alias b='cd... (7 Replies)
Discussion started by: blackeyed
7 Replies

8. Shell Programming and Scripting

Alias problem with awk command

Hi to all, I'm facing some problems when adding an alias like: #alias list="ls -al | awk '{ print $1, $2, $3, $4, (($5/1048576))"\t", $6, $7, $8, $9 }'" and when I enter: #list I get: Syntax Error The source line is 1. The error context is { print >>> , <<< awk:... (3 Replies)
Discussion started by: enux
3 Replies

9. UNIX for Dummies Questions & Answers

Create alias files (not alias commands)

If one: $ find -name 'some expression' -type f > newfile and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory. I am... (3 Replies)
Discussion started by: Alexander4444
3 Replies

10. Shell Programming and Scripting

awk alias passing a value to a variable

I am trying to turn this into an alias with no luck. I would then like to put the alias into my bashrc file. I know awk is very picky about quotes. I have tried every version of quotes, single quotes, double quotes, and backslashes that I can think of. VAR=$(xrandr | awk '$2=="connected"{s=$1}... (3 Replies)
Discussion started by: cokedude
3 Replies
OCF_HEARTBEAT_SFEX(7)						OCF resource agents					     OCF_HEARTBEAT_SFEX(7)

NAME
ocf_heartbeat_sfex - Manages exclusive access to shared storage using Shared Disk File EXclusiveness (SF-EX) SYNOPSIS
sfex [start | stop | monitor | meta-data | validate-all] DESCRIPTION
Resource script for SF-EX. It manages a shared storage medium exclusively . SUPPORTED PARAMETERS
device Block device path that stores exclusive control data. (required, string, no default) index Location in block device where exclusive control data is stored. 1 or more is specified. Default is 1. (optional, integer, default 1) collision_timeout Waiting time when a collision of lock acquisition is detected. Default is 1 second. (optional, integer, default 1) monitor_interval Monitor interval(sec). Default is 10 seconds (optional, integer, default 10) lock_timeout Valid term of lock(sec). Default is 100 seconds. The lock_timeout is calculated by the following formula. .sp lock_timeout = monitor_interval + "The expiration time of the lock" .sp We suggest 90 seconds as a default value of the "The expiration time of the lock", but you should change it in consideration of access delay to the shared disk and the switch time of the multipath driver. .sp The lock timeout have an impact on start action timeout because start action timeout value is calculated by the following formula. .sp start timeout = collision_timeout + lock_timeout + "safety margin" .sp The "safety margin" is decided within the range of about 10-20 seconds(It depends on your system requirement). (optional, integer, default 100) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 120s. stop Stops the resource. Suggested minimum timeout: 20s. monitor Performs a detailed status check. Suggested minimum timeout: 10s. Suggested interval: 10s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5s. EXAMPLE
The following is an example configuration for a sfex resource using the crm(8) shell: primitive p_sfex ocf:heartbeat:sfex params device=string op monitor depth="0" timeout="10s" interval="10s" SEE ALSO
http://www.linux-ha.org/wiki/sfex_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_SFEX(7)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy