Visit Our UNIX and Linux User Community


exclude characters in echo command please help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting exclude characters in echo command please help
# 1  
Old 10-26-2009
exclude characters in echo command please help

Hi all,
I wrote one code and i face some difficulties to exclude some characters from the echo command

more specifically the last command is

Code:
echo $a "${RESULT}" >> results_data_srcip

the results which i have taken are:

nfcapd.200908250000 -.352228
nfcapd.200908250005 -.345085

from these results I want to exclude the characters " nfcapd.20090825 " from the echo command. Does anyone know how to do this? Please i need your help Smilie
# 2  
Old 10-26-2009
This will leave out the whole line:
Code:
echo ... | grep -v nfcapd.20090825 >> outfile

If only the pattern should be excluded:
Code:
echo ... | sed 's/nfcapd.20090825//g' >> outfile

# 3  
Old 10-26-2009
Quote:
Originally Posted by zaxxon
This will leave out the whole line:
Code:
echo ... | grep -v nfcapd.20090825 >> outfile

If only the pattern should be excluded:
Code:
echo ... | sed 's/nfcapd.20090825//g' >> outfile

Thank you very much for your help!! it works Smilie
# 4  
Old 10-26-2009
No need to use sed
Code:
echo ${a:16} "${RESULT}" >> results_data_srcip

# 5  
Old 10-26-2009
Quote:
Originally Posted by fpmurphy
No need to use sed
Code:
echo ${a:16} "${RESULT}" >> results_data_srcip

can you explain to me please what does it mean this command ${a:16} ? because i'm new in shell script Smilie

thanks very much also for your help

Previous Thread | Next Thread
Test Your Knowledge in Computers #375
Difficulty: Easy
In December 2008, the Austin Group published a new major Unix revision, known as POSIX:2008 (formally: IEEE Std 1013.1-2008).
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

To remove any invisible and special characters from the file(exclude @#!$*)

Hi Guys, My requirement is to remove any invisible and special characters from the file like control M(carriage return) and alt numerics and it should not replace @#!$% abc|xyz|acd adc|123| 12 Please help on this. Thanks Rakesh (1 Reply)
Discussion started by: rakeshp
1 Replies

2. UNIX for Beginners Questions & Answers

To remove any invisible and special characters from the file(exclude @!#$&*)

Hi Guys, My requirement is to remove any invisible and special characters from the file like control M(carriage return) and alt numerics and it should not replace @#!$% abc|xyz|acd adc|123| 12 Please help on this. Thanks Rakesh (1 Reply)
Discussion started by: rakeshp
1 Replies

3. Shell Programming and Scripting

Exclude directories in FIND command

Can you please help tweak the below command to exclude all directories with the name "logs" and "tmp" find . -type f \( ! -name "*.tar*" ! -name "*.bkp*" \) -exec /usr/xpg4/bin/grep -i "user_1" /dev/null {} + >result.out bash-3.2$ uname -a SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v... (9 Replies)
Discussion started by: mohtashims
9 Replies

4. Shell Programming and Scripting

How-To Exclude Directory in find command

How can i tweak the below find command to exclude directory/s -> "/tmp/logs" find . -type f \( ! -name "*.log*" ! -name "*.jar*" \) -printNote: -path option/argument does not work with the version of find that i have. bash-3.2$ uname -a SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v (7 Replies)
Discussion started by: mohtashims
7 Replies

5. AIX

Exclude Directories in my tar command

Hi, im having some issues after i execute the next command: tar -cvf /varios/restore/test.tar -X /jfma/test1/excludefile /jfma | gzip -c > /varios/restore/test.tar.gz this creates the desired "test.tar.gz" file, but whe i try to open it it says "tar: 0511-164 There is a media read or write... (6 Replies)
Discussion started by: blacksteel1988
6 Replies

6. Shell Programming and Scripting

working with tar exclude command

i have issue with tar, let me explain when i run below command it works perfectly as usual. tar -cvf /tmp/temp.tar --exclude="exclusion expression" dir my requirement is --exclude="exclusion expression" will come from another variable. so when i execute below command: tar -cvf... (2 Replies)
Discussion started by: ajayyadavmca
2 Replies

7. Shell Programming and Scripting

Echo is replacing characters

Hi All, I'm using KSH and am writing a small script that counts the lines of various files in several folders under one root folder. Below is the script: #!/usr/bin/ksh common_path_in="/interface_in/rsc" file_out="/interface_in/rsc/record_count.csv" tot_rec_count=-1 act_rec_count=-1... (5 Replies)
Discussion started by: jagari
5 Replies

8. Shell Programming and Scripting

Find command with exclude

I had a Shell script that removes the files that are in a directory older than the specified days. find /test/files -mtime +10 I would like to add another condition to the find command above that is to exclude any file starting with CGU' Thanks (1 Reply)
Discussion started by: db2dbac
1 Replies

9. Shell Programming and Scripting

awk and sed, how to exclude certain characters

Hello everyone: I have ran into this a few times now where my skills are just not up to snuff when it comes to Unix. So, I came here to find some beard stroking Unix wizard to help me. Basically, I am using OS X 10.5 in large scale at work and sometimes I have to run some custom reports. ... (5 Replies)
Discussion started by: tlarkin
5 Replies

10. UNIX for Dummies Questions & Answers

How to echo password characters

Hi All, I was wondering, how can I echo password using a character such as '*' in unix? In my machine, password is not echoed, so it is only blank space when I enter any password. So, when I enter a command such as "lock", how can I set the echo character to "*" or something else for... (4 Replies)
Discussion started by: mukluk
4 Replies

Featured Tech Videos