Search Results

Search: Posts Made By: priyanka.premra
2,136
Posted By Corona688
I can see why that didn't work. `cat file` isn't...
I can see why that didn't work. `cat file` isn't just a useless use of cat, it also doesn't do what you want -- it will split on all whitespace, not just lines.

Did you try any of our suggestions...
2,136
Posted By Yoda
#!/bin/bash while read line do ...
#!/bin/bash

while read line
do
for word in ${line//,/ }
do
[[ "$word" = "INFO" ]] && continue # skip if $word = INFO
grep "$word" test.txt...
1,971
Posted By pamu
OR Try $ awk '{gsub(","," "); ...
OR Try

$ awk '{gsub(","," ");
for(i=2;i<=NF;i++){
if(!A[$i]++){
X[$1]=X[$1]?X[$1]","$i:$1" "$i}}}
END{print X[$1]}' file

XPAR 1,196,95,77
1,971
Posted By Yoda
awk -F'[, ]' ' p ~ $1 { ...
awk -F'[, ]' ' p ~ $1 {
for(i=2;i<=NF;i++) {
if($i != "")
printf ",%s",$i;
...
1,971
Posted By Don Cragun
The script bipinajith provided puts out a <comma>...
The script bipinajith provided puts out a <comma> before the first XPAR value, uses <comma> instead of <comma><space> to separate XPAR values, and outputs duplicated XPAR values multiple times. I...
Showing results 1 to 5 of 5

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