Search Results

Search: Posts Made By: Sheel
2,454
Posted By Sheel
Basics echo Unix o/p Unix echo "Unix" ...
Basics

echo Unix o/p Unix
echo "Unix" o/p Unix
echo 'Unix' o/p Unix
echo "'Unix'" o/p 'Unix'
echo '"Unix"' o/p "Unix"
echo ''Unix'' o/p Unix
echo ""Unix"" o/p Unix
9,767
Posted By Sheel
TIMESTAMP=$( date +%m%d%y.%H%M%S ) ...
TIMESTAMP=$( date +%m%d%y.%H%M%S )
FILE="${FILE}.${TIMESTAMP}"
2,718
Posted By Sheel
Try this too - awk '/pattern/...
Try this too -
awk '/pattern/ {for(i=0;i<15;i++) {print;if(!getline) exit;} }' inputFile
3,729
Posted By Sheel
This works for me grep -i "$ip" file
This works for me
grep -i "$ip" file
8,307
Posted By Sheel
Assuming that 9th field gives the name of file...
Assuming that 9th field gives the name of file from ls command.

cd /var/ww/vhost
ls -ltr *.js| grep -v '^d' | awk '{print$9}' > fileList
while read line
do
nbrOfLines=`wc -l $line |...
1,437
Posted By Sheel
You can use cut character option to get the...
You can use cut character option to get the result
while read line
do
firstFour=`echo $line|cut -c1-5`
lastThree=`echo $line|cut -c6-8`
echo "First Four= $firstFour"
...
1,529
Posted By Sheel
use %d or %.2f
use %d or %.2f
1,529
Posted By Sheel
help with adding up numbers
inputFile
2
3
4
5

Command
awk 'BEGIN{sum=0} {sum += $1} END{print sum}' inputFile. Output from the command is 14.

You can also try adding scale e.g. scale=2 to the command.
10,937
Posted By Sheel
It worked fine for me. See if there are...
It worked fine for me. See if there are syntactical errors in your file. Here is the script you might be looking for :

Script - read.ksh
# STEP 1 - Replace the commas within double quotes with...
10,937
Posted By Sheel
Whats the error ?
Whats the error ?
10,937
Posted By Sheel
I dont think we can do it in a single line. I can...
I dont think we can do it in a single line. I can suggest you a way though: Filter out the rows having double quotes into a new file and write a command particualry for that file.

---------- Post...
10,937
Posted By Sheel
For this case particulary : awk -F","...
For this case particulary :

awk -F"," '{print $1","$NF}' inputFile . Will not work if the last column has more than one field wrapped inside quotes.
2,543
Posted By Sheel
That is the actual code. Did you try it ?
That is the actual code. Did you try it ?
2,543
Posted By Sheel
You can create a file with the parameters. This...
You can create a file with the parameters. This will have all the values that need to be used in place of 248. Read this file in another script using while loop and use sed to replace and create...
2,286
Posted By Sheel
how to get last status-id from these records?
Looking for all lines that end with tag </L> & Considering the output to be always present in 3rd last line :

grep -n "\/L>" xmlfile | tail -3 | head -1 | awk '{print $3}'
1,792
Posted By Sheel
There are problems with the basic syntaxes you...
There are problems with the basic syntaxes you have used. See my last post.
1,792
Posted By Sheel
This is what i suggested: while read...
This is what i suggested:


while read line
do
column1=`echo $line|awk -F":" '{print $1}'`
column2=`echo $line|awk -F":" '{print $2}'`
echo "column1 = $column1"
echo "column2 =...
1,792
Posted By Sheel
problem hendling lov in FOR loop
Are trying to read the values separated by colon (:) into two different variables ? If so, you can use while loop to iterate throught the file and read the columns into variables using awk command:...
3,396
Posted By Sheel
I did say AIX (post#8) .. seems u missed it but...
I did say AIX (post#8) .. seems u missed it but thats ok. Tried tr, sed ,awk .. but none working. Pls see if u can get me a soln.

---------- Post updated at 11:56 PM ---------- Previous update...
3,396
Posted By Sheel
This is what i get from the command you suggested...
This is what i get from the command you suggested
<?xml version="1.0" encoding="UTF-8"?>n<Root>n<Person>n<Name>John</Name>n</Person>n<Person>n<Name>John</Name>n</Person>n</Root>
3,396
Posted By Sheel
I am using AIX and dont have an option to use...
I am using AIX and dont have an option to use xpath.

Was trying this command to format the file sed 's/\>\</\>\\n\</g' input . But this gives an output
<?xml version="1.0"...
3,396
Posted By Sheel
Have tried all the options (grep . sed & awk) but...
Have tried all the options (grep . sed & awk) but none of these seem to perform well when the file has 1 billion rows in it. There is one catch though. The input xml file has all the tags in a single...
3,396
Posted By Sheel
I am using a simple awk statement awk...
I am using a simple awk statement awk '/\<Name\>/' inputfile | wc -l
3,396
Posted By Sheel
Need an efficient way to search for a tag in an xml file having millions of rows
Hi,

I have an XML file with around 1 billion rows in it and i am trying to find the number of times a particular tag occurs in it. The solution i am using works but takes a lot of time (~1 hr)...
1,996
Posted By Sheel
How can we get a column specific replacement ?
How can we get a column specific replacement ?
Showing results 1 to 25 of 59

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