Sponsored Content
Top Forums Shell Programming and Scripting Repeat command with new variable for each line in txt file Post 302814533 by pasc on Wednesday 29th of May 2013 03:53:21 PM
Old 05-29-2013
The code itself looks like this:
Code:
while read x 
do
  find /var/mobile/Applications -maxdepth 2 -name "$x" >> /var/mobile/z_renapps/"$x".sh
  sed -i "s|$x|iTunesMetadata.plist|g" /var/mobile/z_renapps/"$x".sh
  sed -i "s|/var|sudo cp /var|g" /var/mobile/z_renapps/"$x".sh
  echo "/Applications/RenApple.app/0Metadata/09240920.plist" >> /var/mobile/z_renapps/"$x".sh
  sed -i "s|09240920|$x|g" /var/mobile/z_renapps/"$x".sh
  sed -i ':a;N;$!ba;s/\n/\t/g' /var/mobile/z_renapps/"$x".sh
  sed -i "s|plist /|plist /|g" /var/mobile/z_renapps/"$x".sh
done < /Applications/RenApple.app/applist.txt

The lines in the text file (that is being read)
Quote:
line1
line2
....
line52
The problem is I KNOW that the last line is not processed, because even if the find command is not executed properly, there will still be the creation of the .sh file at least.
Due to that file missing I'm absolutely sure that this line was skipped/whatever.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command to list .txt and .TXT file

Hi expersts, in my directory i have *.txt and *.TXT and *.TXT.log, *.txt.log I want list only .txt and .TXT files in one command... how to ?? //purple (1 Reply)
Discussion started by: thepurple
1 Replies

2. Shell Programming and Scripting

Problems reiterating values from txt file into a variable

Hi, I have written a script to retrieve phone numbers from an error log and output the phone numbers into an text file. I then use the list of phone numbers to process each value into a variable so I can run a sql query and update the database. My problem is I can only process the first value... (2 Replies)
Discussion started by: rdr411
2 Replies

3. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

4. UNIX for Dummies Questions & Answers

Command to delete numbers at beginning of txt file line

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt awk 'NR%2==0' test1.txt >... (4 Replies)
Discussion started by: li_bi
4 Replies

5. Shell Programming and Scripting

assigning variable in txt file

Hi all, One of my txt file has common format like . And I need to manually assign variable to "/a/b/c/file1/txt" , which has common text before "Calculated summary file:". I wonder if I can use some command to do that for me, that it read the file and check for that comonn text and assign... (2 Replies)
Discussion started by: emily
2 Replies

6. Shell Programming and Scripting

How to echo $variable into txt file?

Hello i tried many times echo $variables into text file with no success for example: echo "#!/bin/sh BBHTAG=RFOCLT_check # What we put in bb-hosts to trigger this test COLUMN=RFOCLT # Name of the column, often same as tag in bb-hosts $BBHOME/bin/bbhostgrep $BBHTAG | while read... (5 Replies)
Discussion started by: mogabr
5 Replies

7. Shell Programming and Scripting

Need to append the date | abcddate.txt to the first line of my txt file

I want to add/append the info in the following format to my.txt file. 20130702|abcd20130702.txt FN|SN|DOB I tried the below script but it throws me some exceptions. <#!/bin/sh dt = date '+%y%m%d'members; echo $dt+|+members+$dt; /usr/bin/awk -f BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Discussion started by: harik1982
6 Replies

8. Shell Programming and Scripting

Repeat for different variable

Hey, I've created following script: var1=test1 setA=testA if ... touch $setA/$var1 ... fi I would like now the repeat the command touch (in this example) for different variables. So below, the varX should run 3 times (var1, var2, var4). Var3 is skipped in this example... (4 Replies)
Discussion started by: brononius
4 Replies

9. UNIX for Dummies Questions & Answers

Split Every Line In Txt Into Separate Txt File, Named Same As The Line

Hi All Is there a way to export every line into new txt file where by the title of each txt output are same as the line ? I have this txt files containing names: Kandra Vanhooser Rhona Menefee Reynaldo Hutt Houston Rafferty Charmaine Lord Albertine Poucher Juana Maes Mitch Lobel... (2 Replies)
Discussion started by: Nexeu
2 Replies

10. Shell Programming and Scripting

Read in txt file and run a different command for each line

hi, i'm trying to write a tcsh script that reads in a text file (one column) and the runs a different command for each line of text. i've found lots of example commands for bash, but not for tcsh. can anyone give me a hint? thanks, jill (8 Replies)
Discussion started by: giuinha
8 Replies
mipagentstat(1M)					  System Administration Commands					  mipagentstat(1M)

NAME
mipagentstat - show Mobile IP Mobility Agent status SYNOPSIS
mipagentstat [-fhp] DESCRIPTION
Use the mipagentstat utility to display the content of various Mobile-IP related data structures. Visitor Table (First Form) The visitor table display lists information for all mobile nodes registered with the foreign agent, one mobile node per line. This list consists of the mobile node's home address or Network Access Identifier (NAI), home agent address, total registration lifetime and the num- ber of seconds remaining before the registration expires. The following command line shows the output from a foreign agent with two mobile nodes registered: example# mipagentstat -f Mobile Node Foreign Agent Time Granted Time Remaining Flags (in secs) (in secs) foobar@xyz.com fa1@tuv.com 600 125 10.1.5.23 123.2.5.12 1000 10 R An "R" in the flags column indicates a reverse tunnel is present. No reverse tunnel is configured for the mobile node foobar@xyz.com. A reverse tunnel is configured from mobile node 10.1.5.23. Binding Table (Second Form) The binding table display lists information for all mobile nodes registered with the home agent, one mobile node per line. This list con- sists of the mobile node's home address or NAI, foreign agent address, total registration lifetime and the number of seconds remaining before the registration expires. Use the following command line to show the output from a home agent with two active mobile nodes: example# mipagentstat -h Mobile Node Home Agent Time Granted Time Remaining Flags (in secs) (in secs) foobar@xyz.com ha1@xyz.com 600 125 10.1.5.23 10.1.5.1 1000 10 R An "R" in the flags column indicates a reverse tunnel is present. No reverse tunnel is configured for the mobile node foobar@xyz.com. A reverse tunnel is configured for mobile node 10.1.5.23. Agent Table (Third Form) The agent table display lists information for all current mobility agent-peers, that is all mobility agents with which mobile-nodes we are servicing are trying to obtain service. Provided in this display are the IPsec protection mechanisms being used with registration requests, replies, and tunnels. Use the following command line to show the output from a home agent with two (foreign) mobility agent peers: example# mipagentstat -hp Foreign ..... Security Association(s)..... Agent Requests Replies FTunnel RTunnel ------------------------ -------- -------- -------- -------- fa.eng.example.com AH,ESP AH,ESP AH,ESP AH,ESP fa.central.example.com AH AH ESP ESP Use the following command line to show the output from a home agent with two (foreign) mobility agent peers: example# mipagentstat -fp Home ..... Security Association(s) ..... Agent Requests Replies FTunnel RTunnel ------------------------ -------- -------- -------- -------- ha.eng.example.com AH,ESP AH,ESP AH,ESP AH,ESP ha.central.example.com Use of the -p option without specifying the agent results in both displays described above, that is one display for each agent. An AH in any column indicates the IPsec AH mechanism is in place for those datagrams. An ESP in any column indicates the IPsec ESP mechanism is in place for those datagrams. OPTIONS
The following options are supported: -f Display the list of active mobile nodes in the foreign agent's visitor's list. -h Display the list of active mobile nodes in the home agent's binding table. -p Display the list of mobility agent peers, and the IPsec protection mechanisms currently in use for registration and tunnel traf- fic. EXIT STATUS
The following exit values are returned: 0 Successful completion. non-zero An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWmipu | +-----------------------------+-----------------------------+ SEE ALSO
mipagent(1M), mipagentconfig(1M), mipagent.conf(4), attributes(5) Aboda, B., and Beadles, M. RFC 2486, The Network Access Identifier. The Internet Society, 1999. SunOS 5.10 11 Dec 2001 mipagentstat(1M)
All times are GMT -4. The time now is 08:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy