Script for data entry


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script for data entry
# 1  
Old 08-22-2008
Script for data entry

Hello everyone. I just registered like 17 minutes ago and am new to UNIX/Linux. I work in a small department of an animation company that does compositing tricks to fix movie frames. After our work is completed we are tasked with creating a text log that has information on what work we had performed and basic shot information. I have taken C++ programming ages ago in a junior college, but barely remember anything. I want to create a script to make these log files for me and my co-workers. All of the information that goes into the logs are easily found in the terminal and it is just a matter of copying and pasting the information into a new file. Creating the files take anywhere from ten minutes to half an hour and it is a major pain in the butt.

The script I have created so far just echoes the easily found data onto the terminal for copying and pasting. That was the easy part. Now what I need is to figure out three more things to have an awesome script.

1. I need a way to echo out the user name of the person that created a file in a different directory.

2. Echo out my own user name.

3. Echo a list of directories with "pf_" (e.g. pf_blurFix)

Again, I am a UNIX/Linux noob and don't have too much experience programming. Any help would be very much appreciated.

Here is my current script:

Code:
# This is a script to put in the basic info for the dreaded READMEs

#! /usr/local/bin/tcsh -fb

# "echo" everything on screen for copying
echo ================================================================================
echo Paint fix notes for:
a_get a_sq_name; a_get a_shot_name 
date +%D
echo 
echo SUP, TEAM
echo
echo ligherUsername, lighter
echo myUsername, pf
echo
echo Frames:
a_get a_firstfield; a_get a_lastfield
echo 
echo notes:
echo 
echo ________________________________________________________________________________
echo 
echo node info:
echo 
echo ================================================================================

# 2  
Old 08-22-2008
I just figured out a way to echo my username:

Code:
cd ~; pwd|awk -F"/" '{print $NF}'

So I know that pwd shows your path, but I don't know what the stuff to the right of that does.


Also, for #1:
The name of the file is going to be "light.#.r"
The # can be found using this command:

Code:
a_get a_firstfield

I don't know how to use that in the script to echo the username of the person who created that file light.#.r though.
# 3  
Old 08-22-2008
to echo your username

Code:
# whoami
root

# 4  
Old 08-22-2008
Quote:
Originally Posted by AndrewP
I just figured out a way to echo my username:

Code:
cd ~; pwd|awk -F"/" '{print $NF}'

So I know that pwd shows your path, but I don't know what the stuff to the right of that does.
pwd = shows current directory

awk -F"/" = splits output of pwd on every /

if you were in /usr/local/ it would split "usr" and "local"

'{print $NF}' prints 'Last field'
in this case it would print "local" as "usr" would be first field and "local" would be last field.

Code:
# cd /usr/local; pwd|awk -F"/" '{print $NF}'
local

# 5  
Old 08-22-2008
Geeez. That whoami is pretty clever. Thanks Ikon.
# 6  
Old 08-22-2008
I'm still working on this script and have run into a problem. Within a script, is it possible to navigate to other directories and list their contents? If I just type the command line in the terminal it works. But, if I use the script with the same command line, it doesn't work.
# 7  
Old 08-22-2008
post your script so we can see what you are doing, or trying to do.

be sure to put in code tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cron entry to pass the value to script

0 I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below: File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)" Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3... (2 Replies)
Discussion started by: bhartiya007
2 Replies

2. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

3. Shell Programming and Scripting

awk script to call another script based on second column entry

Hi I have a text file (Input.txt) with two column entries separated by tab as given below: aaa str1 bbb str2 cccccc str3 dddd str4 eee str3 ssss str2 sdf str3 hhh str1 fff str2 ccc str3 ..... ..... ..... (1 Reply)
Discussion started by: my_Perl
1 Replies

4. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

5. Programming

Hire Personal Assistant | SEO Virtual Assistant | Data Entry Service | Content Writing

Hello Everyone, Here I am offereing my Services Word Posting Content Posting PDF to excel or word Image to Ms Word typeing Document Creation Video Creation Any type Copy-Paste Ads Posting Article Posting Manual Directory Submission PR Submission Social Bookmarking Web 2.0 Blogs... (1 Reply)
Discussion started by: abseova
1 Replies

6. Shell Programming and Scripting

Automatic su password entry script

Before I start, two things. 1) Yes I know it's bad practice and obomination to all things holy, but I'm not a sys admin at JP Morgan, I'm a hobbyist tooling about in a VM, in my pants, at home. 2) If you are just going to flame for even considering hardcoding a root password, thanks, I get... (2 Replies)
Discussion started by: 3therk1ll
2 Replies

7. Shell Programming and Scripting

Creation of script,if the data file have more than one entry!!!

1.Daily there will be 14 files in the data directory 2.someday's the 14 files receive more than once r twice with different time stamps....we need to chk the count of the file and if the count of the file is two.we need to combine the both the files. 3. if any duplicate data is there just... (1 Reply)
Discussion started by: bobprabhu
1 Replies
Login or Register to Ask a Question