Sponsored Content
Top Forums Shell Programming and Scripting awk if statement to evaluate string and compare Post 302579569 by ahamed101 on Tuesday 6th of December 2011 04:20:22 AM
Old 12-06-2011
Try this...
Code:
amixer... | awk '/^  Front Left/{if($7~"[off]"){print "MUTED"}}'

--ahamed
This User Gave Thanks to ahamed101 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Very urgent :- How to compare string using if statement

Hi How can i compare a string using if statement in a script? For eg: I have filename="abc.sh" if ;then { ....... ....... } fi but this doesnot work .. How will i execute this ?? Thanks in advance (1 Reply)
Discussion started by: jisha
1 Replies

2. Shell Programming and Scripting

Evaluate string containing shell variable names

Hello, I have this: #!/usr/bin/ksh V1=ABC str="hello 123;${V1}" eval "echo $str" i get hello 123 /script.sh ABC not found However eval works if $str variable doesn't contain a semicolumn (eg if str="hello 123~${v1}" running the eval statement above would produce (2 Replies)
Discussion started by: endorphin
2 Replies

3. Shell Programming and Scripting

[awk]compare a number in a string with a list

Hi, I have a program written in awk and I want to extend it to do another task. My program is a list of CVS log reports of a repository. For each file, I have some fields. One of the fields is the comment field. I want to know how I can check if a comment (which is a free text field)... (8 Replies)
Discussion started by: sandeepk1611
8 Replies

4. Shell Programming and Scripting

How to evaluate a string of numbers in the same command of AWK

Hi, I am trying to do evaluate one numerical string after substitution. ++++++++++++++++== What I have = "7.04+2.3Xlog(0.72e-6X1.0e6)X1.9596" What I need = evaluate 7.04+2.3*log(0.72e-6*1.0e6)*1.9596 = 5.55941 what I am doing; echo "7.04+2.3Xlog(0.72e-6X1.0e6)X1.9596" | awk... (2 Replies)
Discussion started by: vivek_shm74
2 Replies

5. Shell Programming and Scripting

How to Evaluate two conditions in single if statement

I am trying to test two conditions in a single if and getting syntax error on -a and && if ] ; then echo "variable a equals to variable b" else echo "variable a not equal to variable b" fi in second attempt I used -a instead of &&, referring to other website, but not sure that... (1 Reply)
Discussion started by: praxis1
1 Replies

6. Shell Programming and Scripting

awk - how to compare part of the string?

Need help for awk.. file will have comma separated numbers, I need check digits before 10 numbers eg ( 001)1234567890 Basically want to check country code of a mobile number. eg: abc,def,data, data,0011234567890, data,data Script should be checking country code with 001, I will pass... (10 Replies)
Discussion started by: vegasluxor
10 Replies

7. Shell Programming and Scripting

String compare using awk - what am I doing wrong?

Hi all, I was doing some string manipulation in my script and wanted to try using awk. However, I have been stuck with string compare. A simplified form of my conundrum is given below: The below prints expected result (prints "Completed because that is the second element"): $ echo... (5 Replies)
Discussion started by: faraway
5 Replies

8. Shell Programming and Scripting

Evaluate Expression within awk

I want to create a conditional expression string and pass in an awk script. My script is as below... comm="\$3 == "hello"" awk -F "^T" -v command="${comm}" ' { if ( command ) { print "hye" } }' testBut the statement "if ( command )" always evaluates to true which is not... (5 Replies)
Discussion started by: Saikat123
5 Replies

9. UNIX for Advanced & Expert Users

How to evaluate expression under awk?

I have to display only those subscribers which are in "unconnected state" and the date is 90 days older than today's date. Below command is used for this purpose: cat vfsubscriber_20170817.csv | sed -e 's/^"//' -e '1d' | \ nawk -F '",' '{if ( (substr($11,2,4) == 2017) && ( substr($11,2,8)... (1 Reply)
Discussion started by: dia
1 Replies

10. UNIX for Beginners Questions & Answers

Concatenate a string and number and compare that with another string in awk script

I have below code inside my awk script if ( $0 ~ /SVC IN:/ ) { svc_in=substr( $0,23 , 3); if (msg_start == 1 && msg_end == 0) { msg_arr=$0; } } else if ( $0 ~ /^SVC OUT:/ ) { svc_out=substr( $0, 9, 3); if (msg_start == 1 && msg_end == 0) ... (6 Replies)
Discussion started by: bhagya123
6 Replies
AMIXER(1)						      General Commands Manual							 AMIXER(1)

NAME
amixer - command-line mixer for ALSA soundcard driver SYNOPSIS
amixer [-option] [cmd] DESCRIPTION
amixer allows command-line control of the mixer for the ALSA soundcard driver. amixer supports multiple soundcards. amixer with no arguments will display the current mixer settings for the default soundcard and device. This is a good way to see a list of the simple mixer controls you can use. COMMANDS
help Shows syntax. info Shows the information about a mixer device. scontrols Shows a complete list of simple mixer controls. scontents Shows a complete list of simple mixer controls with their contents. set or sset <SCONTROL> <PARAMETER> ... Sets the simple mixer control contents. The parameter can be the volume either as a percentage from 0% to 100% with % suffix, a dB gain with dB suffix (like -12.5dB), or an exact hardware value. The dB gain can be used only for the mixer elements with available dB information. When plus(+) or minus(-) letter is appended after volume value, the volume is incremented or decremented from the current value, respectively. The parameters cap, nocap, mute, unmute, toggle are used to change capture (recording) and muting for the group specified. The optional modifiers can be put as extra parameters to specify the stream direction or channels to apply. The modifiers playback and capture specify the stream, and the modifiers front, rear, center, woofer are used to specify channels to be changed. A simple mixer control must be specified. Only one device can be controlled at a time. get or sget <SCONTROL> Shows the simple mixer control contents. A simple mixer control must be specified. Only one device can be controlled at a time. controls Shows a complete list of card controls. contents Shows a complete list of card controls with their contents. cset <CONTROL> <PARAMETER> ... Sets the card control contents. The identifier has these components: iface, name, index, device, subdevice, numid. The next argument specifies the value of control. cget <CONTROL> Shows the card control contents. The identifier has same syntax as for the cset command. OPTIONS
-c card Select the card number to control. The device name created from this parameter has syntax 'hw:N' where N is specified card number. -D device Select the device name to control. The default control name is 'default'. -s | --stdin Read from stdin and execute the command on each line sequentially. When this option is given, the command in command-line arguments is ignored. Only sset and cset are accepted. Other commands are ignored. The commands to unmatched ids are ignored without errors too. -h Help: show syntax. -q Quiet mode. Do not show results of changes. EXAMPLES
amixer -c 1 sset Line,0 80%,40% unmute cap will set the second soundcard's left line input volume to 80% and right line input to 40%, unmute it, and select it as a source for capture (recording). amixer -c 1 -- sset Master playback -20dB will set the master volume of the second card to -20dB. If the master has multiple channels, all channels are set to the same value. amixer -c 1 set PCM 2dB+ will increase the PCM volume of the second card with 2dB. When both playback and capture volumes exist, this is applied to both volumes. amixer -c 2 cset iface=MIXER,name='Line Playback Volume",index=1 40% will set the third soundcard's second line playback volume(s) to 40% amixer -c 2 cset numid=34 40% will set the 34th soundcard element to 40% BUGS
None known. AUTHOR
amixer is by Jaroslav Kysela <perex@perex.cz>. This document is by Paul Winkler <zarmzarm@erols.com> and Jaroslav Kysela <perex@perex.cz>. 11 Aug 2000 AMIXER(1)
All times are GMT -4. The time now is 06:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy