How to manipulate the output ???


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to manipulate the output ???
# 1  
Old 12-23-2005
How to manipulate the output ???

In an operation, I have output like 22562K [(some no)K] I want to manipulate this and want to perform some mathematical operations on that, any idea how can I get the digit no?
# 2  
Old 12-23-2005
pls do check other posting before posting new one..

here is the previous post to remove the last character :

https://www.unix.com/shell-programming-and-scripting/23945-how-pick-out-last-charactor-string.html
# 3  
Old 12-23-2005
try this

val=22562K
echo $val | tr -cd [0-9]
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Manipulate condition to send mail based on output text in file

Hi All, I have a working script as below. echo "Files loaded with $(cat /var/tmp/script.X1.out)" | mail -s "Files loaded with return code" mailid This script takes the output from script.X1.out file and appends the text "Files loaded with return code" and sends the email. Now what I want... (5 Replies)
Discussion started by: midhun3108
5 Replies

2. Shell Programming and Scripting

A better way to manipulate text

Good morning everyone, I'm currently trying to convert an environment variable into a string and then attach it at the end of a command and launch it. I have the following right now, but it's very ugly: AMI_TAGS="env=test,country=XX,city=blah,galaxy=blahblah" aws ec2 create-tags... (8 Replies)
Discussion started by: da1
8 Replies

3. Shell Programming and Scripting

Manipulate all rows except header, but header should be output as well

Hello There... I have a sample input file .. number:department:amount 125:Market:125.23 126:Hardware store:434.95 127:Video store:7.45 128:Book store:14.32 129:Gasolline:16.10 I will be doing some manipulations on all the records except the header, but the header should always be... (2 Replies)
Discussion started by: juzz4fun
2 Replies

4. Shell Programming and Scripting

Manipulate file

Hi Guys, I have a file that lists patches along with other information. The patches are listed in two different formats. One format lists the latest patch, date , installed patch Latest Patch Date IN 148412-02 13-Sep-2012 -- X X SunOS 5.10: nss_dns patch 126206-10 ... (5 Replies)
Discussion started by: Tornado
5 Replies

5. UNIX for Dummies Questions & Answers

Writing a loop to manipulate a script and store it in multiple output files

I have a script where the the 9th line looks like this: $filename=sprintf("250.1chr%d.ped", $N); I want to modify this script 1000 times, changing 250.1chr%d.ped to 250.2chr%d.ped, 250.3chr%.ped.......and so on all the way to 250.1000chr%d.ped and store each output in files called ... (4 Replies)
Discussion started by: evelibertine
4 Replies

6. Shell Programming and Scripting

manipulate & format the output of spool command

Hi All, I am spooling the data some sql queries into a single file but wanted to know how to format the data of the file generated by spool. #!/bin/sh unset -f USAGE USAGE () { clear echo "############################USAGE#######################\n" echo "Incorrect number of... (2 Replies)
Discussion started by: ss_ss
2 Replies

7. Shell Programming and Scripting

Manipulate files

Hi everybody: I have a problem. I have a output files which have this pattern: number1 --space block1a - 7rows/10columns/65elements --space block1b - 7rows/10columns/65elements --space block1c - 7rows/10columns/65elements --space number2 --space block2a - 7rows/10columns/65elements... (0 Replies)
Discussion started by: tonet
0 Replies

8. Shell Programming and Scripting

manipulate a passed in parameter

I am passing a file name as a parameter to shell script the parameter is getfile.txt.gpg how do i process this parameter to get name like getfile.txt only and eleminate the .gpg text?? Thanks in advance (2 Replies)
Discussion started by: rudoraj
2 Replies

9. Shell Programming and Scripting

How to manipulate date?

Hi can u pls help me out with this as i am relatively new to unix. I need to use 4 different types of dates in my shell script * first day of the last(previous) month * last day of the last(previous) month * first day of the current month * (sysdate-1) yesterday's date for the current... (5 Replies)
Discussion started by: phani
5 Replies
Login or Register to Ask a Question