Search Results

Search: Posts Made By: deadyetagain
6,752
Posted By vgersh99
depending on what your desired output should be: ...
depending on what your desired output should be:

awk -F, '!a[$2]++{next} {print "Line " NR " " $2 " is duplicated"}' myFile
OR
awk -F, '!a[$2]++' myFile
5,381
Posted By RudiC
Why don't you use the mechanism meant to pass...
Why don't you use the mechanism meant to pass parameters into awk: awk -vAWKVAR1="$SHELLVAR1" -vAWKVAR2="$SHELLVAR2" etc ...
29,730
Posted By hanson44
$ cat input hiring,no system,yes hiring,yes...
$ cat input
hiring,no
system,yes
hiring,yes
quota,no
quota,maybe

$ sort input | awk 'NR == 1 {p=$1; next} p == $1 { print $1 " is duplicated"} {p=$1}' FS=","
hiring is duplicated
quota is...
1,527
Posted By Corona688
You don't need sed for that in bash or ksh: ...
You don't need sed for that in bash or ksh:

VERSION="${VERSION//\//\\/}"

if you are forced to use an old shell:

VERSION=$(echo "$VERSION" | sed 's#/#\\/#g'
1,527
Posted By Yoda
sed 's#\/#\\\/#g' OR sed 's#\/#\\&#g'
sed 's#\/#\\\/#g'
OR
sed 's#\/#\\&#g'
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 01:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy