Search Results

Search: Posts Made By: puttster
3,763
Posted By jim mcnamara
& is the pattern space. \& is the character "&". ...
& is the pattern space. \& is the character "&". \ is called "escape" it means take the next character literally not as a special character or a metacharacter.


sed /%26/\&/g'

is what it...
Forum: Programming 10-30-2010
2,911
Posted By Corona688
That's not correct, I suggest you try what I...
That's not correct, I suggest you try what I posted instead.

You're just allocating pointers. A pointer to nothing can't hold anything. You need to allocate memory for them to point to, too,...
1,700
Posted By DGPickett
sed ' $!N $!N s/\n/ /g '
sed '
$!N
$!N
s/\n/ /g
'
5,392
Posted By rdcwayx
awk 'NR<=4' infile awk 'NR==2' infile
awk 'NR<=4' infile

awk 'NR==2' infile
5,392
Posted By kurumi
$ ruby -ne '(print and exit) if $.==2 ' file
$ ruby -ne '(print and exit) if $.==2 ' file
3,039
Posted By Chubler_XL
If you have to stick with /bin/sh, you could use...
If you have to stick with /bin/sh, you could use /dev/random as discussed here: Random Number with /bin/sh - Linux / UNIX Forum (http://nixcraft.com/shell-scripting/14861-random-number-bin-sh.html)...
2,244
Posted By zaxxon
sed '5!d' infile
sed '5!d' infile
2,244
Posted By jim mcnamara
awk (nawk on solaris)example: When the statement...
awk (nawk on solaris)example: When the statement between ' and ' evaluates to true, the fifth line has just been input, it means print this line, the default awk action.

# awk
awk 'NR==5'...
4,216
Posted By Scrutinizer
Hi, I meant the closing / actually ;). Have you...
Hi, I meant the closing / actually ;). Have you discovered the "[code] tags" button already?
4,216
Posted By DGPickett
Oh, he wanted spaces, well, some enhancements are...
Oh, he wanted spaces, well, some enhancements are left to the student! I guess our look and post cycles crossed, so like a pair of bad script processes! :D
4,216
Posted By Scrutinizer
Hi, DGPickett, you probably mean: sed...
Hi, DGPickett, you probably mean:
sed 's/\(.*\),/\1 it /'
nice.
4,216
Posted By DGPickett
sed 's/\(.*\),/\1it/' My sed may not always...
sed 's/\(.*\),/\1it/'

My sed may not always be as terse as the awk from awk gurus, but you might figure out what it does and how it does it more easily. The wild card .* is a greedy spring...
1,327
Posted By Scrutinizer
sed 's/,/STUFF/5'
sed 's/,/STUFF/5'
1,269
Posted By anbu23
Echoes the number of characters in var echo...
Echoes the number of characters in var
echo ${#var}
1,836
Posted By Chubler_XL
Neat /bin/bash solution frans, here is one with...
Neat /bin/bash solution frans, here is one with /bin/sh
#!/bin/sh
i=1
LEN=$( echo $1 | wc -c )
while [ $i -lt $LEN ]
do
ARRAY[$i]="$( echo $1 | cut -c$i )"
let i=i+1
done
echo Element...
1,855
Posted By DGPickett
Suppose you had a CSV file you wanted to be a...
Suppose you had a CSV file you wanted to be a table. Ignoring quotes and quoted commas for the moment (Access 2000 does, so why not me?), this would turn it into table guts:

sed '
...
3,818
Posted By kurumi
$ dos2unix file $ tr -d '\r' < file $ ruby...
$ dos2unix file
$ tr -d '\r' < file
$ ruby -i.bak -pne 'gsub("\r","")' file
3,818
Posted By durden_tyler
Your data file is messed up. Run the following...
Your data file is messed up. Run the following command and then run grep.


dos2unix your_file your_file


If you do not have "dos2unix" in your system, try "dos2ux".
Otherwise, you could try...
3,818
Posted By durden_tyler
Just a hunch, but check if there are any funky...
Just a hunch, but check if there are any funky characters in your data file.


od -bc your_file


tyler_durden
3,818
Posted By durden_tyler
Why does the length of the line matter ? Despite...
Why does the length of the line matter ? Despite the length of the line, grep should display all lines that match the pattern.

tyler_durden
3,818
Posted By jlliagre
Your grep looks broken. What OS and grep version...
Your grep looks broken. What OS and grep version are you using ?

$ echo $s
#
$ cat $a
stanle#y hey
tc#p ss#h
udp tcp
PDB CDB
$ grep "$s" $a
stanle#y hey
tc#p ss#h
$ grep -c "$s" $a
2
Showing results 1 to 21 of 21

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