Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: Subbeh
1,104
Posted By Subbeh
Thanks guys, Not sure if it's the best...
Thanks guys,

Not sure if it's the best solution, but in the end I chose to create another nested function to run the awk command:

function csvdiff() {
function _csvdiff() {
awk '
...
1,104
Posted By Subbeh
Variable input to awk script
Hi guys,

I wrote the following function to compare two csv files column by column.
However, sometimes the input needs to be sorted before parsing it to awk.

I can do this by changing the awk...
672
Posted By Subbeh
Thanks! Works great
Thanks! Works great
672
Posted By Subbeh
Read character and use as separator
Hi all,

I'm trying to read in a character and use it as a separater on a string:

#!/bin/ksh

echo "Enter input line"
read input_header

echo "Enter separator:"
read separator
...
13,937
Posted By Subbeh
Thanks, the client is not a problem as it works...
Thanks, the client is not a problem as it works from another system running Solaris (this one is Red Hat). I just found out about the mailx -a option which also attaches files. I guess I'll use this.
13,937
Posted By Subbeh
Uuencode for mail attachments not working
Hi,

I'm trying to send mail with attachments using uuencode, but it doesn't work.

Command (also tried with mailx):
uuencode testfile testfile | mail emailadress

The email I get doesn't...
1,200
Posted By Subbeh
Grep in a specific file in an archive
Hi all,

I need to do a grep in a specific file inside multiple (tar.gz) archives.

I know zgrep can grep in an archive, but as far as I know, I can't supply a specific filename from inside the...
819
Posted By Subbeh
Another way to do it in awk: awk '/Mamma/ { s=x...
Another way to do it in awk:
awk '/Mamma/ { s=x ; getline ; next } s { print s } { s=$0 } END { print s }' file
1,106
Posted By Subbeh
Give this a try: awk '{x=substr($0,10,10);...
Give this a try:
awk '{x=substr($0,10,10); gsub(/\|/," ",x); print substr($0,0,10), x, substr($0,20)}' OFS="" file
553
Posted By Subbeh
Try this: awk '/---/{p++;next} p==2' file
Try this:
awk '/---/{p++;next} p==2' file
1,004
Posted By Subbeh
You can't put variables in the shebang. You could...
You can't put variables in the shebang. You could use the following depending on if you have the right bash path in your $PATHvariable:
#!/usr/bin/env bash
11,512
Posted By Subbeh
Hi wisecracker, I think I understand the OPs...
Hi wisecracker, I think I understand the OPs request quite clearly the way he described it. And although you make a valid point, I consider it as a data entry issue which I think is out of scope here.
11,512
Posted By Subbeh
This should fix it: sed -e :a -e...
This should fix it:

sed -e :a -e "s/\([^,]\)\"\([^,]\)/\1'\2/g;ta" file
11,512
Posted By Subbeh
Try this instead: sed...
Try this instead:
sed "s/\([^,]\)\"\([^,]\)/\1'\2/g" file
11,512
Posted By Subbeh
I don't understand the commotion, a simple sed...
I don't understand the commotion, a simple sed would suffice, no?

$ sed 's/\([^,]\)\"\([^,]\)/\1\x27\2/g' file...
1,767
Posted By Subbeh
You can use SSH to execute commands remotely,...
You can use SSH to execute commands remotely, have a look at the manual. You'll need to use either expect or sshpass to parse the password. In any case, it's always better to connect using an ssh-key.
5,712
Posted By Subbeh
Thanks Jim, although it's not exactly what I was...
Thanks Jim, although it's not exactly what I was looking for.

I know the awk, tac and rev solutions but was especially interested in getting a good sed example for educational purposes as it was...
5,712
Posted By Subbeh
Reverse words with sed
Hi guys,

I'm wondering what the best way would be to reverse words in a string based on certain characters.

For example:
echo Word1Word2Word3Word4 | sed '
/\n/ !G
...
1,183
Posted By Subbeh
Which OS and version of sed do you use? You...
Which OS and version of sed do you use?

You could try this:
find . -type f -iname *.ics -exec sed -i '/^DT\(START\|END\)/s/[0-9][0-9]$/00/;s/\r//' {} \;
1,183
Posted By Subbeh
Try this and make sure you have a backup of all...
Try this and make sure you have a backup of all your files:
find . -type f -iname *.ics -exec sed -i -e '/^DT\(START\|END\)/s/[0-9][0-9]$/00/' -e 's/\r//' {} \;

if the carriage return is not...
1,657
Posted By Subbeh
try something like this: print...
try something like this:

print glob.glob("abc.*")
728
Posted By Subbeh
Using grep, assuming that the timestamp is 12+...
Using grep, assuming that the timestamp is 12+ characters, and there are no other 12+ digit numbers in the filename:
echo test.input.20130501010101.txt | grep -o '[0-9]\{12,\}*'
717
Posted By Subbeh
Try this: tcpdump -i eth1 icmp[0] =8...
Try this:

tcpdump -i eth1 icmp[0] =8 >output.txt &
sleep 60; kill $!
7,484
Posted By Subbeh
Don't look for a literal ^M, instead look for the...
Don't look for a literal ^M, instead look for the special character which you can obtain by pressing 'ctrl-v+m'
1,824
Posted By Subbeh
Have a look at the man pages;
Have a look at the man pages;
Showing results 1 to 25 of 325

 

Featured Tech Videos

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