Sponsored Content
Top Forums Shell Programming and Scripting Question regarding cat command Post 302341658 by asirohi on Thursday 6th of August 2009 10:28:13 AM
Old 08-06-2009
Hi,
I chaged the script a little bit,
#!/bin/sh

FIX_XML_PATH=/home/administrator/testfix/fix
FIX_FILE=`ls $FIX_XML_PATH | grep xml`

echo $FIX_FILE
cat $FIX_FILE

Variable $FIX_FILE store a xml file.Smilie


*******logs*******


$ sh -vx xmlParse.sh
#!/bin/sh

FIX_XML_PATH=/home/administrator/testfix/fix
+ FIX_XML_PATH=/home/administrator/testfix/fix
FIX_FILE=`ls $FIX_XML_PATH | grep xml`
ls $FIX_XML_PATH | grep xml
++ ls /home/administrator/testfix/fix
++ grep xml
+ FIX_FILE=fix_com.ibm.rational.clearcase.nt_i386.ifix0003_7.1.2.0000-7-
0-2009B-TESTFIX-CC-D090803_for_7.1.2.0000-7-1-0-02-00-2009B-D090617.xml

echo $FIX_FILE
+ echo fix_com.ibm.rational.clearcase.nt_i386.ifix0003_7.1.2.0000-7-1-0-
09B-TESTFIX-CC-D090803_for_7.1.2.0000-7-1-0-02-00-2009B-D090617.xml
fix_com.ibm.rational.clearcase.nt_i386.ifix0003_7.1.2.0000-7-1-0-02-00-2
TFIX-CC-D090803_for_7.1.2.0000-7-1-0-02-00-2009B-D090617.xml
cat $FIX_FILE
+ cat fix_com.ibm.rational.clearcase.nt_i386.ifix0003_7.1.2.0000-7-1-0-0
9B-TESTFIX-CC-D090803_for_7.1.2.0000-7-1-0-02-00-2009B-D090617.xml
cat: fix_com.ibm.rational.clearcase.nt_i386.ifix0003_7.1.2.0000-7-1-0-02
B-TESTFIX-CC-D090803_for_7.1.2.0000-7-1-0-02-00-2009B-D090617.xml: No su
or directory
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

strange cat question.

Does anyone know what the microprograms behind cat (and other commands) are like? In what language are those programs designed? Is their source available somewhere? No particular reason, just wondering. I know it's a bit strange... (3 Replies)
Discussion started by: sanchopansa
3 Replies

2. Shell Programming and Scripting

question about cat in script

hi all i have some script echo $$ > process-id d='cat process-id' if test-s "TMP"$d then echo "serv1" else echo "serv2" fi the variable d should contain the number of the process, instead of that it contains 'cat process-id' how shall i do that the d will contain only the number?... (6 Replies)
Discussion started by: naamas03
6 Replies

3. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

4. OS X (Apple)

Question about cat and echo

Hello, I am trying to send text to a USB to serial adaptor and then to an external speech synthesizer. I tried using the cat and echo commands with no luck. I have gotten some audio output from my synthesizer using Kermit a terminal emulator, so I am pretty sure my synthesizer and my USB to serial... (1 Reply)
Discussion started by: jamesapp
1 Replies

5. Shell Programming and Scripting

Easy cat question

I am having problems getting a list of filenames that I want from a directory. example: I have 3 files - filename.xxx.20110505.123030 filename.yyy.20110505.123030 filename.zzz.20110505.123030 There may be multiple xxx,... (3 Replies)
Discussion started by: Drenhead
3 Replies

6. Shell Programming and Scripting

cat question

Can any one guide me how can i accomplish this by script i continuously receive files via our ftp server into a certain folder is there a way i can take those files cat it to a new file by hour and create a new file when new hour starts? (4 Replies)
Discussion started by: shehzad_m
4 Replies

7. UNIX for Dummies Questions & Answers

Question regarding Cat

Can we concatenate say, I have a few files prefixing with 2009... So now i want all the 2009 files into one single file.. Can this be achieved???? (4 Replies)
Discussion started by: saggiboy10
4 Replies

8. Shell Programming and Scripting

cat question

hello! why this works? cd /home/user cat * | ecasound -i stdin -o jack and this doesn't? cd /home/user/somedirectory cat * | ecasound -i stdin -o jack somedirectory are full with exe files which are the best source for this sort of noise thing (10 Replies)
Discussion started by: karlhungus
10 Replies

9. Shell Programming and Scripting

Simple cat and echo question

Apologies, probably a really simple problem: I've got a text file (nh.txt) with this in it: user1 email1 email2 user2 email1 email2 etc With the following basic script: for tline in $(cat nh.txt) do echo "**********" echo $tline done ... (3 Replies)
Discussion started by: nelmo
3 Replies

10. Homework & Coursework Questions

Cat/File Descriptor Question

For the command below, I need to understand what exactly the command does and provide an examples for which the output will be saved to file save2... From my understanding, if the file provides an error in the first half of the pipe, it'll save to save1 and will never give an error to save to... (2 Replies)
Discussion started by: ayz649
2 Replies
STAG-GREP(1p)						User Contributed Perl Documentation					     STAG-GREP(1p)

NAME
stag-grep - filters a stag file (xml, itext, sxpr) for nodes of interest SYNOPSIS
stag-grep person -q name=fred file1.xml stag-grep person 'sub {shift->get_name =~ /^A*/}' file1.xml stag-grep -p My::Foo -w sxpr record 'sub{..}' file2 USAGE
stag-grep [-p|parser PARSER] [-w|writer WRITER] NODE -q tag=val FILE stag-grep [-p|parser PARSER] [-w|writer WRITER] NODE SUB FILE stag-grep [-p|parser PARSER] [-w|writer WRITER] NODE -f PERLFILE FILE DESCRIPTION
parsers an input file using the specified parser (which may be a built in stag parser, such as xml) and filters the resulting stag tree according to a user-supplied subroutine, writing out only the nodes/elements that pass the test. the parser is event based, so it should be able to handle large files (although if the node you parse is large, it will take up more memory) ARGUMENTS
-p|parser FORMAT FORMAT is one of xml, sxpr or itext, or the name of a perl module xml assumed as default -w|writer FORMAT FORMAT is one of xml, sxpr or itext, or the name of a perl module -c|count prints the number of nodes that pass the test -filterfile|f a file containing a perl subroutine (in place of the SUB argument) -q|query TAG1=VAL1 -q|query TAG2=VAL2 ... -q|query TAGN=VALN filters based on the field TAG other operators can be used too - eg <, <=, etc multiple q arguments can be passed in for more complex operations, pass in your own subroutine, see below SUB a perl subroutine. this subroutine is evaluated evry time NODE is encountered - the stag object for NODE is passed into the subroutine. if the subroutine passes, the node will be passed to the writer for display NODE the name of the node/element we are filtering on FILE the file to be parser. If no parser option is supplied, this is assumed to a be a stag compatible syntax (xml, sxpr or itext); otherwise you should parse in a parser name or a parser module that throws stag events SEE ALSO
Data::Stag perl v5.10.0 2008-12-23 STAG-GREP(1p)
All times are GMT -4. The time now is 07:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy