•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,432 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,604 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 2737 | Replies: 2
![]() |
The experts here will correct and berate me if I am wrong, but while I don't under stand what the
code means, the entire line of
Appears to calculate the variable AHS_DATA divided by the variable i and outputs the result to i.dat...
This statement:
appears to be some formatting instructions, but don't take my word on it...
's/ *\|/\|/g;perl -ne 's/ *\|/\|/g; print' ${AHS_DATA}/${i} > ./${i}.dat This statement:
's/ *\|/\|/g; -n means suppress output (i.e. read the lines in the file, but don't output them).
And the print after that means output the lines where the "command" actually did anything (i.e. any line that did not have any occurrences of
s/ *\|/\|/g; means replace all occurrences of of zero or more whitespace followed ba a "|" (i.e. "|", or " |", or " |") with "|".And the print after that means output the lines where the "command" actually did anything (i.e. any line that did not have any occurrences of
"|" will not be output).${AHS_DATA} is a variable holding a directory name.${i} is the variable from the loop (table1 or table2 or table3 etc), and references a file of that name in the above directory. sed will read this file for the "lines" of input referenced above.> ./${i}.dat means that all output should go into a file in the currect directory called table1.dat (or table2.dat, or table3.dat, etc, depending on the value of ${i}) Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- I want to manipulate the registry key values through a vb.net application (VB.NET)
- Some commands not working after ssh into a shell (KSH) (Shell Scripting)
- Korn Shell Script for deleting files older than 2 months (Shell Scripting)
- Problem in Korn shell script (Shell Scripting)
- Help with FOR loop (Shell Scripting)
- Simple Problem (Getting the Assigned Value within loop dynamically) (Shell Scripting)
- Quick Reference for Linux Commands (Getting Started and Choosing a Distro)
Other Threads in the Shell Scripting Forum
- Previous Thread: Giving a user access to additional groups
- Next Thread: ksh scripting



Linear Mode