Search Results

Search: Posts Made By: Shivdatta
849
Posted By Shivdatta
Thanks,that helps. Can you explain what does...
Thanks,that helps.
Can you explain what does the below do ?



awk -F"[,;]"
849
Posted By Shivdatta
Split records
Hi

I have a file


$cat test
a,1;2;3
b,4;5;6;7
c,8;9


I want to split each record to multiple based on semicolon in 2nd field.
i.e


a,1
a,2
a,3
b,4
b,5
1,614
Posted By Shivdatta
Thanks, both the solutions (for loop & xargs...
Thanks,

both the solutions (for loop & xargs ) works fine.

Just wondering if i can avoid creating .tmp files and directly replace in the source file itself.
,something like perl does (inplace...
1,614
Posted By Shivdatta
Redirection with xargs.
In a dir, i have a huge number of files and i want to replace a occurance
of say "abc" with "xyz".

I tried using grep and xargs but it fails



grep -l "abc" * | xargs -I{} "sed...
8,685
Posted By Shivdatta
I just gave an example that needs an change when...
I just gave an example that needs an change when migrating to Linux.
I am basically needing an "exhaustive list" with changes like these documented.

Can anyone help ?
8,685
Posted By Shivdatta
No it doesnt , one of the example : ...
No it doesnt , one of the example :



Linux :
$echo "\nabc"
\nabc

Solaris:
$echo "\nabc

abc
8,685
Posted By Shivdatta
ksh script migration from Solaris to Linux.
We are migrating some scripts (ksh) from Solaris 10 to Linux 2.6.32.

Can someone share list of changes i need to take care for this ?

Have found few of them but i am looking for a exhaustive...
1,304
Posted By Shivdatta
Thanks, that helps. Was just wondering , if...
Thanks, that helps.

Was just wondering , if this thing is specific to GAWK 'coz nawk works fine on Solaris


$ cat test | nawk '{FS="-"} {print $2 " " $3 " " $1}'
03 01 2013
1,304
Posted By Shivdatta
Gawk output difference
Why the below option2 doesn't fetch similar output as option1 ? I am on linux.



$cat test
2013-01-01-00.25.43.643845

Option1:
cat test | gawk -F"-" ' {print $2 " " $3 " " $1}'
01 01 2013...
1,944
Posted By Shivdatta
thanks for the replies,but my concern here is why...
thanks for the replies,but my concern here is why doesnt that work fine on SunOS 5.10
1,944
Posted By Shivdatta
Issues with sed on SunOS
Why does the below command doesnt work fine on SunOS 5.10



$ cat t
| AK| | | | | DS | | | | tAR | | | | | FIL |


$ sed -e 's/^ *//g' -e 's/ *$//g' -e 's/ *|...
2,205
Posted By Shivdatta
set ksh script in restricted mode
Hi,

I came across a post wherein you can use "set -r"(on bash) to activate restricted mode ( wherein you cant run some commands such as cd etc).

Can anyone guide if we have anything similar in...
6,715
Posted By Shivdatta
Makes sense, When you use NR, does gsub splits...
Makes sense, When you use NR, does gsub splits fields into lines ?

i.e
Line1: A,
Line2: B,B ##had quotes
Line3: ,C,D,
Line4: A,B ##had quotes
Line5: ,E,
Line6: GG,H ##had quotes
...
6,715
Posted By Shivdatta
yes thanks, that works fine but w/ nawk, btw can...
yes thanks, that works fine but w/ nawk, btw can you please explain what NR%2 is doing here and what does '1' at the end mean in gsub



$ cat dd
A,"B,B",C,D,"A,B",E,"GG,H"...
6,715
Posted By Shivdatta
The post closes there with no result on awk. ...
The post closes there with no result on awk.

Only the perl approach works, I am looking out for awk approach


perl -MText::ParseWords -nle'
print join "|", parse_line(",",0, $_);
'...
6,715
Posted By Shivdatta
Convert csv to pipe delimited except the ones in double quotes
I have a csv data file :
A,B,C,D,"A,B",E,"GG,H"
E,F,G,H,I,J,"S,P"

I need to replace all "," with "|" except the ones between double quotes i.e
A|B|C|D|"A,B"|E|"GG,H"
E|F|G|H|I|J|"S,P"

CAn...
2,096
Posted By Shivdatta
works fine for me,is that what you are trying ...
works fine for me,is that what you are trying

$ ls -1
a.1024
a.1025
c

$if [ ! -f ~/a.* ]
> then
> echo "success"
> else
> echo "fail"
> fi
fail




Since there are 2 files , it...
3,207
Posted By Shivdatta
Doesnt work for me on Solaris. Tried both the...
Doesnt work for me on Solaris.
Tried both the variants
/usr/bin/sort & /usr/xpg4/bin/sort

$/usr/bin/sort -s -t"," -k1,2 t
/usr/bin/sort: illegal option -- s
usage: sort [-cmu] [-o output] [-T...
3,207
Posted By Shivdatta
It again has the same problem. I want ...
It again has the same problem. I want "Jim,212121,Seattle" should be coming before "Jim,212121,Ohio" as that comes first in the order in the file.
I just want to sort on 1 st field
3,207
Posted By Shivdatta
Sort help on non numeric field
Hi,

I am unable to sort data on the first field


$cat t
Jim,212121,Seattle
Bill,404404,Seattle
Steve,246810,Nevada
Scott,212277,LosAngeles
Jim,212121,Ohio

sort -t"," -k1,2 t...
3,084
Posted By Shivdatta
Yes I am on solaris. I tried your command,it...
Yes I am on solaris.
I tried your command,it does not give error but the o/p is different than what
i am expecting.It is removing all the occurances of "@".Seems it is not able to interpret "4"...
3,084
Posted By Shivdatta
The perl script works splendid but i'm looking...
The perl script works splendid but i'm looking for a UNIX approach.
Wonder why sed 's/@/ /4g' gives an error :(
3,084
Posted By Shivdatta
Thanks for the reply but i'm getting an error ...
Thanks for the reply but i'm getting an error
sed: command garbled: s/@/ /4g . Are you sure 4g works that way.
3,084
Posted By Shivdatta
Remove 3rd and onwards occurances of a character
I have a file with "@" in every line
fdgfgddfg@sfsdfdsf@dfdfd@@vfdfsdfd@
sfsdfs@sdfd@gfhfgh@@ddffg@sdf@
srfgtfsdfs@sdfertrd@eergfhfgh@@ddffg@sdf@
wttrtrt@sdfd@sdfdf@@sdfdfds@@@

I need to...
1,301
Posted By Shivdatta
That does seems to work . Getting an error awk:...
That does seems to work . Getting an error
awk: syntax error near line 1
awk: bailing out near line 1
Showing results 1 to 25 of 103

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